I’m feeling really stupid right now 😊

Ive been a Qt user for almost 20 years, and I cant believe I have never had to 
deal with this before.

If you are working with a path, for use in QDir, QFileInfo, QFile etc etc, and 
the path string is using a ~, either of the form ~/foo.txt or ~user/foo.txt, Qt 
seems to be treating it as a relative path of the current user, and prepends 
“/home/scott” in my case to the path, and of course, the canonicalPath returns 
an empty string because that file path is invalid and doesn’t exist.

What is the Qt way to handle this?  It cant be to tell your users not to use ~. 
 Can it? Does everyone write their own little “analyze the string before 
actually using it, and handle ~”?

Thanks
Scott


_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to