Pergunta

I have the following:

Q_ASSERT(QFile::exists("\\.host\Shared Folders\username On My Mac\Desktop\New Deck.txt"));

The file is picked from QFileDialog but when check if it exists with QFile::exists it returns FALSE;

Is there any reason why QT cannot open a file on a shared drive.

Btw, this path is a valid one on Windows and is generated by putting the "New Deck.txt" file on my Mac OSX desktop and tried to be read from a QT application run from VM Ware Windows XP SP2.

Foi útil?

Solução

You must escape \ in the string literal via \: "\\.host\Shared Folders\..." Also, unless this is for your debugging only, asserting on the existing of files is a bad idea. The file could always disappear between selecting it in the file dialog and opening it.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top