Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConfuserEx.CLI cannot use a path with spaces in -out parameter #17

Open
LamerTex opened this issue Jan 18, 2018 · 3 comments
Open

ConfuserEx.CLI cannot use a path with spaces in -out parameter #17

LamerTex opened this issue Jan 18, 2018 · 3 comments

Comments

@LamerTex
Copy link

Hi I'm trying to use ConfuserEX.CLI in VisualStudio via a PostBuild Event to confuse the output files of the project. This is the script I'm using:
If $(ConfigurationName) == Release+Obfuscated (
$(ProjectDir)..\..\ConfuserEx_bin\Confuser.CLI.exe -n -out=$(TargetDir) $(TargetPath)
)

And it is working fine normally. The problems begin when the paths contains some spaces, to use them I need to add " " so the script become:

If $(ConfigurationName) == Release+Obfuscated (
"$(ProjectDir)..\..\ConfuserEx_bin\Confuser.CLI.exe" -n -out="$(TargetDir)" "$(TargetPath)"
)

In this way the first and third parameters work again (both the Confuser.CLI.exe and the input module "$(TargetPath)" are found), but the second one, the one that specify the output folder, give the following error:

[ERROR] Unknown error occurred. Exception: System.ArgumentException: Characters not valid in the path. in System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional) in System.IO.Path.Combine(String path1, String path2) in Confuser.Core.ConfuserEngine.RunInternal(ConfuserParameters parameters, CancellationToken token) in C:\Users\MatteoTex\Downloads\ConfuserEx-Reborn-master\Confuser.Core\ConfuserEngine.cs:row 92

So I can't use ConfuserEx when the projects has some spaces in its path... I'm doing something wrong or it is a problem with the control for the -out parameter?

Thanks for the attention,
Matteo Tessarotto.

@eucharistia
Copy link

The issue here might be caused by the scripting language, I can’t see off the bat what that language is, but I assume it is PowerShell, considering you are using Windows.

To make it easier to read your post, can you define what language your script is in in markdown?

I would try a similar script in maybe another scripting language and if you still have issues with -out arguments with spaces.

If all else fails the code can be modified to not crash when it receives such input, I may be able to fix that if time makes it possible.

@LamerTex
Copy link
Author

I confirm it is Powershell/windows batch script language because in the "postbuild" event of visual studio in windows that is the used language

@jhedlund
Copy link

jhedlund commented Jun 1, 2018

I had a similar problem with encasing the output directory with quotes, I was able to work around the issue by ensuring there is no trailing backslash in the output directory. It seems the NDesk.Options class that parses the command line escapes that quote if the backslash is there and then fails to correctly parse the rest of the line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants