Improve root directory behavior and AddMods.

This commit is contained in:
Ottermandias 2024-06-17 14:50:33 +02:00
parent b3f8762494
commit 250c4034e0
3 changed files with 13 additions and 9 deletions

View file

@ -75,7 +75,9 @@ public class ModsApi : IPenumbraApiMods, IApiService, IDisposable
if (!dir.Exists)
return ApiHelpers.Return(PenumbraApiEc.FileMissing, args);
if (dir.Parent == null || Path.GetFullPath(_modManager.BasePath.FullName) != Path.GetFullPath(dir.Parent.FullName))
if (dir.Parent == null
|| Path.TrimEndingDirectorySeparator(Path.GetFullPath(_modManager.BasePath.FullName))
!= Path.TrimEndingDirectorySeparator(Path.GetFullPath(dir.Parent.FullName)))
return ApiHelpers.Return(PenumbraApiEc.InvalidArgument, args);
_modManager.AddMod(dir);