What do you need the quotes for? Is "INSTALLDIR" an environment variable you are trying to set or is it a real argument for the program?
What do you need the quotes for? Is "INSTALLDIR" an environment variable you are trying to set or is it a real argument for the program?
It's not an environment variable, I'm actually trying to set a Windows Installer property for an installer that I'm calling from my Qt program, and this installer is actually quite sensitive to these extra double quotes.
It seems that the Qt code should attempt to parse the arguments and ignore spaces that are already escaped and enclosed within double quotes, rather than just indiscriminately check if the arg contains a space anywhere in it. And I'd rather not have to try to modify Qt source and I wish there was a way around it... cursed time deadlines![]()
Software Engineer
But do you need any quotes here? Try removing your quotes, they are probably not needed at all.
Actually I never heard of Qt adding any quotes to parameters. I don't know how this is on Windows, but on Unix systems they are not needed because the argument is simply pushed into the array of arguments passed to execve() later on. Are you certain those quotes are really there? I would be surprised if this behaviour was platform dependent.It seems that the Qt code should attempt to parse the arguments and ignore spaces that are already escaped and enclosed within double quotes, rather than just indiscriminately check if the arg contains a space anywhere in it. And I'd rather not have to try to modify Qt source and I wish there was a way around it... cursed time deadlines![]()
Can you show us the code you have written to spawn the external process?
Yes, it needs the quotes around the path, otherwise it will interpret only only up to the first space in the pathname. And the external program won't interpret my argument at all if it has quotes entirely around it. "INSTALLDIR=C:\Program Files\Folder" doesn't work.
well, i guess that's why they had to write a qprocess_win.cpp
For the curious, the program is essentially any Windows Installer installer exe, or if you have an msi file, you can run it through with msiexec.exe passing in the property described above, which should be on any Windows computer.
Qt Code:
.arg(mSetDest.installFolder()) QStringList args; args << arg; mpInstallProcess->start(cmd, args);To copy to clipboard, switch view to plain text mode
Software Engineer
"It" being the installer? Because your application will treat it as a single argument, I'm sure of that. That's what those additional quotes are for.
Try:And the external program won't interpret my argument at all if it has quotes entirely around it. "INSTALLDIR=C:\Program Files\Folder" doesn't work.
Qt Code:
To copy to clipboard, switch view to plain text mode
Provided one is running Windows... And if the installer can't handle those quotes, it's simply dumb and should be replaced by some more intelligent application.For the curious, the program is essentially any Windows Installer installer exe, or if you have an msi file, you can run it through with msiexec.exe passing in the property described above, which should be on any Windows computer.
Have you tried triple quoting?
http://doc.trolltech.com/4.3/qprocess.html#start-2
Bitto / Andreas Aardal Hanssen - andreas dot aardal dot hanssen at nokia
Nokia Software Manager, Qt Development
Have you tried:
INSTALLDIR=C:\Progra~1\Folder
Windows provides some backward compatibility to older systems where filenames were restricted to 8 characters.
Bookmarks