Workaround(s) for having spaces in the Path for Qt Assistant Document collection?



  • 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.



  • 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



  • 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);
     
    }
    

    @



  • I'm glad it helped :)



  • 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);@



  • Thanks Mulder. That works and is more elegant.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.