Workaround(s) for having spaces in the Path for Qt Assistant Document collection?
-
wrote on 2 Aug 2013, 16:46 last edited by
Is there a workaround to have spaces in the path for Qt Assistant document collection? I don't see where this a problem in the documentation but If I put the collection document where there are spaces in the path, it does not work.
-
wrote on 2 Aug 2013, 17:59 last edited by
generally when I have a path with spaces like C:\Program Files I put quotes around it "C:\Program Files".
not sure if this will help ya
-
wrote on 2 Aug 2013, 18:43 last edited by
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);
}
@
-
wrote on 2 Aug 2013, 19:38 last edited by
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)
-
wrote on 6 Aug 2013, 10:57 last edited by
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); }
@
-
wrote on 6 Aug 2013, 16:05 last edited by
I'm glad it helped :)
-
wrote on 6 Aug 2013, 19:16 last edited by
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);@ -
wrote on 7 Aug 2013, 11:09 last edited by
Thanks Mulder. That works and is more elegant.
5/8