Hi all,
I want to use a user command to post-process the axf file. I enclose the command in quotes to preserve spaces in the path. However, if I also use quotes to enclose parameters in quotes, then the external command does not get called. If I don't enclose the parameters in quotes, the external command is called but the parameter is not parsed correctly.
As an example, a batch file called test_cmd.bat:
echo Parameter 1 = %1 echo Parameter 2 = %2
If I call this using
"C:\nXDS\nXDS Interface Processor\Application\Release\test_cmd.bat" #L
I get
User command #2: "C:\nXDS\nXDS Interface Processor\Application\Release\test_cmd.bat" C:/nXDS/nXDS Interface Processor/Application/Release/Obj/nXDS.axf C:\nXDS\nXDS Interface Processor\Application>echo Parameter 1 = C:/nXDS/nXDS Parameter 1 = C:/nXDS/nXDS C:\nXDS\nXDS Interface Processor\Application>echo Parameter 2 = Interface Parameter 2 = Interface ".\Release\Obj\nXDS.axf" - 0 Error(s), 0 Warning(s).
The batch file is called but the parameter is split by the spaces.
If I call using
"C:\nXDS\nXDS Interface Processor\Application\Release\test_cmd.bat" "#L"
User command #2: "C:\nXDS\nXDS Interface Processor\Application\Release\test_cmd.bat" "C:/nXDS/nXDS Interface Processor/Application/Release/Obj/nXDS.axf" --- Error: User Command terminated, Exit-Code = 1 ".\Release\Obj\nXDS.axf" - 1 Error(s), 0 Warning(s).
The batch file does not appear to have been called when both the command and parameter are in quotes.
Apart from the obvious workaround of not using a path containing spaces, is there any solution for this problem?
Regards
"the fact remains that spaces are allowed in filenames under Windows"
And the fact remains that this is and always has been the bane of software development tools - and anything else that relies on command-line utilities.
Filenames with spaces are fine for pointy-clicky GUIs, but a pain for development work.
As noted, I agree that there's a bug in uVision - whether it's "simple" or not is another matter...
And, as noted, it's been there for a long time.
And, even if you get Keil to fix this, you will still be laying a trap for yourself with some other utility or tool...
So, again, the only sensible approach is: Just Don't Do it!
I think just about every coding/development standard I've seen says, "don't have spaces in file or folder names"
So no one has any actual fix?
It specifically says in the uVision documentation, if you have spaces in the path, enclose the parameters in quotes. It should work, but it doesn't. Works on every other toolset I've used.
Perhaps the sensible advice is "just don't use buggy IDEs".
As I said before - No!
"Perhaps the sensible advice is 'just don't use buggy IDEs'"
Again, this is (I think) a uVision bug - but even if the bug were fixed, the basic problem of spaces in pathnames would still be there.
That's probably why the bug is still there after all this time - it's not worth fixing because it really is better to just avoid the issue in the first place.
Similarly, that'll be why nobody has a "solution" - they just avoid creating the problem!