Workaround(s) for having spaces in the Path for Qt Assistant Document collection?
-
The following is how I implement it. I can not get it to work when my app is in C:\Program Files. Instead I have to put it in C:\myDir\myapp
@
void launchHelp()
{
QProcess *proc = new QProcess;QString collectionPath = QApplication::applicationDirPath()+"/man/man.qhc";
QString app = QLatin1String("assistant -hide bookmarks -collectionFile "+collectionPath.toAscii();
proc->start(app);
}
@
-
If nothing else helps, you can always use "Junction":http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx to create a symbolic link - without spaces in the path! - to the problematic folder. For example, you could just link "C:\Program Files\Some Folder With Spaces" to "C:\MySymlink" and use that instead of the original folder...
(Yes, Windows/NTFS does support symbolic links, at least for folders)
-
Buckets, it finally clicked what you were saying. The following is the solution that I used with the escape Quote character ("):
@
void launchHelp()
{
QProcess *proc = new QProcess;QString collectionPath = "\""+QApplication::applicationDirPath()+"/man/man.qhc\""; QString app = QLatin1String("assistant -hide bookmarks -collectionFile "+collectionPath.toAscii(); proc->start(app); }
@
-
Qt automatically wraps arguments with white-spaces into quotes!
But you need to pass them properly, each argument as a separate token:
@QString appDir = QApplication::applicationDirPath();
QString collectionPath = QString("%1/man/man.qhc").arg(appDir);QStringList args;
args << "-hide" << "bookmarks";
args << "-collectionFile" << collectionPath;QProcess *proc = new QProcess;
proc->start("assistant", args);@