Skip to content

Commit c0f1a78

Browse files
committed
prompt to delete
1 parent fadc32f commit c0f1a78

1 file changed

Lines changed: 25 additions & 3 deletions

File tree

Bloxstrap/UI/ViewModels/Settings/CommunityModsViewModel.cs

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,20 +303,42 @@ private async Task DownloadModAsync(CommunityMod mod)
303303
{
304304
await ExtractCustomThemeAsync(tempFile, mod.Name);
305305
Frontend.ShowMessageBox(
306-
$"Custom theme '{mod.Name}' installed successfully!\n\nThe theme has been saved to your Custom Themes folder and will be available in the Themes settings.",
306+
$"Custom theme '{mod.Name}' installed successfully!\n\nThe theme has been saved to your Custom Themes folder and will be available in Custom Launchers.",
307307
MessageBoxImage.Information,
308308
MessageBoxButton.OK
309309
);
310310
App.Logger.WriteLine($"CommunityModsViewModel::DownloadModAsync", $"Installed custom theme: {mod.Name}");
311311
}
312312
else
313313
{
314-
await ExtractModToModificationsAsync(tempFile, mod.Name);
314+
bool hasExistingMods = Directory.Exists(Paths.Modifications) &&
315+
(Directory.GetFiles(Paths.Modifications).Any() ||
316+
Directory.GetDirectories(Paths.Modifications)
317+
.Any(dir => !dir.EndsWith("ClientSettings", StringComparison.OrdinalIgnoreCase)));
318+
319+
if (hasExistingMods)
320+
{
321+
var result = Frontend.ShowMessageBox(
322+
"Existing mods found in the Modifications folder.\n\n" +
323+
$"Would you like to delete existing mods before installing '{mod.Name}'?",
324+
MessageBoxImage.Question,
325+
MessageBoxButton.YesNo
326+
);
327+
328+
if (result == MessageBoxResult.Yes)
329+
{
330+
await CleanModificationsDirectoryAsync();
331+
}
332+
}
333+
334+
await ExtractZipAsync(tempFile);
335+
315336
Frontend.ShowMessageBox(
316-
$"Mod '{mod.Name}' installed successfully!\n\nThe mod has been applied to your Modifications folder and will be used the next time you launch Roblox.",
337+
$"Mod '{mod.Name}' installed successfully!",
317338
MessageBoxImage.Information,
318339
MessageBoxButton.OK
319340
);
341+
320342
App.Logger.WriteLine($"CommunityModsViewModel::DownloadModAsync", $"Installed mod: {mod.Name}");
321343
}
322344
}

0 commit comments

Comments
 (0)