mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-02-21 07:17:53 +01:00
Create newly added mods in import folder instead of moving them.
This commit is contained in:
parent
5b1c0cf0e3
commit
c3b7ddad28
3 changed files with 20 additions and 34 deletions
|
|
@ -196,10 +196,7 @@ public sealed class ModFileSystemSelector : FileSystemSelector<Mod, ModFileSyste
|
|||
}
|
||||
|
||||
while (_modImportManager.AddUnpackedMod(out var mod))
|
||||
{
|
||||
MoveModToDefaultDirectory(mod);
|
||||
SelectByValue(mod);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void DrawLeafName(FileSystem<Mod>.Leaf leaf, in ModState state, bool selected)
|
||||
|
|
@ -379,34 +376,6 @@ public sealed class ModFileSystemSelector : FileSystemSelector<Mod, ModFileSyste
|
|||
_collectionManager.Editor.SetMultipleModStates(_collectionManager.Active.Current, mods, enabled);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If a default import folder is setup, try to move the given mod in there.
|
||||
/// If the folder does not exist, create it if possible.
|
||||
/// </summary>
|
||||
/// <param name="mod"></param>
|
||||
private void MoveModToDefaultDirectory(Mod mod)
|
||||
{
|
||||
if (_config.DefaultImportFolder.Length == 0)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
var leaf = FileSystem.Root.GetChildren(ISortMode<Mod>.Lexicographical)
|
||||
.FirstOrDefault(f => f is FileSystem<Mod>.Leaf l && l.Value == mod);
|
||||
if (leaf == null)
|
||||
throw new Exception("Mod was not found at root.");
|
||||
|
||||
var folder = FileSystem.FindOrCreateAllFolders(_config.DefaultImportFolder);
|
||||
FileSystem.Move(leaf, folder);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_messager.NotificationMessage(e,
|
||||
$"Could not move newly imported mod {mod.Name} to default import folder {_config.DefaultImportFolder}.",
|
||||
NotificationType.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawHelpPopup()
|
||||
{
|
||||
ImGuiUtil.HelpPopup("ExtendedHelp", new Vector2(1000 * UiHelpers.Scale, 38.5f * ImGui.GetTextLineHeightWithSpacing()), () =>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue