Gad D Lord
Gad D Lord

Reputation: 6772

QFile open file on a shared drive

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.

Upvotes: 0

Views: 1815

Answers (1)

Frank Osterfeld
Frank Osterfeld

Reputation: 25165

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.

Upvotes: 1

Related Questions