mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #262 from wabbajack-tools/fix-deleting-downloads
Fix case sensitive bug with download deletion during install
This commit is contained in:
commit
bc057704d0
@ -928,5 +928,12 @@ namespace Wabbajack.Common
|
|||||||
var decoded = ProtectedData.Unprotect(bytes, Encoding.UTF8.GetBytes(key), DataProtectionScope.LocalMachine);
|
var decoded = ProtectedData.Unprotect(bytes, Encoding.UTF8.GetBytes(key), DataProtectionScope.LocalMachine);
|
||||||
return Encoding.UTF8.GetString(decoded).FromJSONString<T>();
|
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);
|
var relative_to = f.RelativeTo(OutputFolder);
|
||||||
Utils.Status($"Checking if modlist file {relative_to}");
|
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;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
Utils.Log($"Deleting {relative_to} it's not part of this modlist");
|
Utils.Log($"Deleting {relative_to} it's not part of this modlist");
|
||||||
File.Delete(f);
|
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="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="ContentRightsManagementTests.cs" />
|
<Compile Include="ContentRightsManagementTests.cs" />
|
||||||
<Compile Include="CompilationStackTests.cs" />
|
<Compile Include="CompilationStackTests.cs" />
|
||||||
|
<Compile Include="UtilsTests.cs" />
|
||||||
<Compile Include="VortexTests.cs" />
|
<Compile Include="VortexTests.cs" />
|
||||||
<Compile Include="WebAutomationTests.cs" />
|
<Compile Include="WebAutomationTests.cs" />
|
||||||
<Compile Include="zEditIntegrationTests.cs" />
|
<Compile Include="zEditIntegrationTests.cs" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user