[Solved]how to get special path in mac
-
I was a windows programmer, and right now begin to developer under mac.
1).How to judge a file or directory is exist.
when I call c function:
return access(fn,0)==0;
when the file or directory is exist, it return true.
but how to differ it really a file or directory?
2).How to get current app path.
for example:
/Users/mike/Qt/Qt Creator.app/Contents/MacOS/Qt Creator
3).How to get current user's document path.
for example:
/Users/szuzsq/Documents/ -
Well, I suggest you just use the Qt API instead of the C API.
- "QFile::exists()":http://doc.qt.nokia.com/latest/qfile.html#exists-2
- "QDir::currentPath()":http://doc.qt.nokia.com/latest/qdir.html#currentPath / "QCoreApplication::applicationFilePath()":http://doc.qt.nokia.com/latest/qcoreapplication.html#applicationFilePath
- "QDir::homePath()":http://doc.qt.nokia.com/latest/qdir.html#homePath / "QDesktopServices::storageLocation()":http://doc.qt.nokia.com/latest/qdesktopservices.html#storageLocation