forked from yck1509/ConfuserEx
-
-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Relative paths are now correctly resolved. Files not inside of the base directory are just copied to the output root directory, without any sub directory structure.
- Loading branch information
Showing
4 changed files
with
62 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System.Collections.Generic; | ||
using Xunit; | ||
|
||
namespace Confuser.Core.Test { | ||
public class UtilsTest { | ||
[Theory] | ||
[MemberData(nameof(BuildRelativePathTestData))] | ||
[Trait("Issue", "https://github.com/mkaring/ConfuserEx/issues/413")] | ||
public void BuildRelativePath(string baseDirectory, string fileReference, string expectedRelativePath) => | ||
Assert.Equal(expectedRelativePath, Utils.GetRelativePath(fileReference, baseDirectory), ignoreCase: true); | ||
|
||
public static IEnumerable<object[]> BuildRelativePathTestData() { | ||
yield return new object[] { "C:\\Test", "C:\\Test\\Asm.dll", "Asm.dll" }; | ||
yield return new object[] { "C:\\Test\\", "C:\\Test\\Asm.dll", "Asm.dll" }; | ||
yield return new object[] { "C:\\Test", "C:\\Test\\Test2\\Asm.dll", "Test2\\Asm.dll" }; | ||
yield return new object[] { "C:\\Test\\", "C:\\Test\\Test2\\Asm.dll", "Test2\\Asm.dll" }; | ||
yield return new object[] { "C:\\Test", "C:\\Test\\Test2\\Test3\\Asm.dll", "Test2\\Test3\\Asm.dll" }; | ||
yield return new object[] { "C:\\Test\\", "C:\\Test\\Test2\\Test3\\Asm.dll", "Test2\\Test3\\Asm.dll" }; | ||
yield return new object[] { "C:\\Test", "C:\\Test2\\Asm.dll", null }; | ||
yield return new object[] { "C:\\Test\\", "C:\\Test2\\Asm.dll", null }; | ||
|
||
// Only for case insensitive file systems (windows) | ||
yield return new object[] { "C:\\Test", "c:\\test\\test2\\test3\\asm.dll", "Test2\\Test3\\Asm.dll" }; | ||
yield return new object[] { "C:\\Test", "C:\\TEST\\TEST2\\TEST3\\ASM.DLL", "Test2\\Test3\\Asm.dll" }; | ||
} | ||
} | ||
} |