开发者

QFile open file on a shared drive

开发者 https://www.devze.com 2023-01-12 18:56 出处:网络
I have the following: Q_ASSERT(QFile::exists(\"\\\\.host\\Shared Folders\\username On My Mac\\Desktop\\New Deck.txt\"));

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开发者_如何学Python 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消