mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Fix case sensitive bug with download deletion during install
This commit is contained in:
parent
45a08b4005
commit
e482197479
@ -928,5 +928,12 @@ namespace Wabbajack.Common
|
||||
var decoded = ProtectedData.Unprotect(bytes, Encoding.UTF8.GetBytes(key), DataProtectionScope.LocalMachine);
|
||||
return Encoding.UTF8.GetString(decoded).FromJSONString<T>();
|
||||
}
|
||||
|
||||
public static bool IsInPath(this string path, string parent)
|
||||
{
|
||||
return path.ToLower().TrimEnd('\\').StartsWith(parent.ToLower().TrimEnd('\\') + "\\");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -348,10 +348,8 @@ namespace Wabbajack.Lib
|
||||
{
|
||||
var relative_to = f.RelativeTo(OutputFolder);
|
||||
Utils.Status($"Checking if modlist file {relative_to}");
|
||||
if (indexed.ContainsKey(relative_to) || f.StartsWith(DownloadFolder + Path.DirectorySeparator))
|
||||
{
|
||||
if (indexed.ContainsKey(relative_to) || f.IsInPath(DownloadFolder))
|
||||
return;
|
||||
}
|
||||
|
||||
Utils.Log($"Deleting {relative_to} it's not part of this modlist");
|
||||
File.Delete(f);
|
||||
|
26
Wabbajack.Test/UtilsTests.cs
Normal file
26
Wabbajack.Test/UtilsTests.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Wabbajack.Common;
|
||||
|
||||
namespace Wabbajack.Test
|
||||
{
|
||||
[TestClass]
|
||||
public class UtilsTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void IsInPathTests()
|
||||
{
|
||||
Assert.IsTrue("c:\\foo\\bar.exe".IsInPath("c:\\foo"));
|
||||
Assert.IsFalse("c:\\foo\\bar.exe".IsInPath("c:\\fo"));
|
||||
Assert.IsTrue("c:\\Foo\\bar.exe".IsInPath("c:\\foo"));
|
||||
Assert.IsTrue("c:\\foo\\bar.exe".IsInPath("c:\\Foo"));
|
||||
Assert.IsTrue("c:\\foo\\bar.exe".IsInPath("c:\\fOo"));
|
||||
Assert.IsTrue("c:\\foo\\bar.exe".IsInPath("c:\\foo\\"));
|
||||
Assert.IsTrue("c:\\foo\\bar\\".IsInPath("c:\\foo\\"));
|
||||
}
|
||||
}
|
||||
}
|
@ -112,6 +112,7 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ContentRightsManagementTests.cs" />
|
||||
<Compile Include="CompilationStackTests.cs" />
|
||||
<Compile Include="UtilsTests.cs" />
|
||||
<Compile Include="VortexTests.cs" />
|
||||
<Compile Include="WebAutomationTests.cs" />
|
||||
<Compile Include="zEditIntegrationTests.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user