Details
-
Bug
-
Resolution: Invalid
-
P2: Important
-
None
-
5.4.0, 5.12.0
-
See the description above
Description
Available via SHGetFolderPath() CSIDL_COMMON_APPDATA /
FOLDERID_ProgramData .
Here's the code for getting all paths values (it would be useful to have it in the Qts' examples):
#include <QCoreApplication> #include <QtDebug> #include <QByteArray> #include <QStandardPaths> #include <QSysInfo> #include <QFile> #include <QSysInfo> #include <QStringBuilder> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); Q_UNUSED(a); QStringList sl; QString fn = QSysInfo::prettyProductName() + QLatin1Literal(" ") % QSysInfo::currentCpuArchitecture() % QLatin1Literal(" with Qt ") % qVersion() % QLatin1Literal(" and QSrgLib standard paths.txt"); QFile outFile(fn); if (!outFile.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) { qWarning() << "Cannot open input file " << fn << "\n"; outFile.close(); return 1; } outFile.write((QLatin1Literal("System info:\n") % QLatin1Literal("\tbuildAbi = ") % QSysInfo::buildAbi() % QLatin1Literal("\n") % QLatin1Literal("\tbuildCpuArchitecture = ") % QSysInfo::buildCpuArchitecture() % QLatin1Literal("\n") % QLatin1Literal("\tcurrentCpuArchitecture = ") % QSysInfo::currentCpuArchitecture() % QLatin1Literal("\n") % QLatin1Literal("\tkernelType = ") % QSysInfo::kernelType() % QLatin1Literal("\n") % QLatin1Literal("\tkernelVersion = ") % QSysInfo::kernelVersion() % QLatin1Literal("\n") % QLatin1Literal("\tprettyProductName = ") % QSysInfo::prettyProductName() % QLatin1Literal("\n") % QLatin1Literal("\tproductType = ") % QSysInfo::productType() % QLatin1Literal("\n") % QLatin1Literal("\tproductVersion = ") % QSysInfo::productVersion() % QLatin1Literal("\n") % QLatin1Literal("\tQt version = ") % qVersion() % QLatin1Literal("\n\n") ).toUtf8()); #define prnLocInfo(location) \ outFile.write((QLatin1Literal(#location ":\n") \ % QLatin1Literal("\tdisplayName = ") \ % QStandardPaths::displayName(QStandardPaths::location) % QLatin1Literal("\n")).toUtf8()); \ sl = QStandardPaths::standardLocations(QStandardPaths::location); \ foreach (QString s, sl) \ outFile.write((QLatin1Literal("\tstandardLocations = ") % s % QLatin1Literal("\n")).toUtf8()); \ outFile.write((QLatin1Literal("\twritableLocation = ") \ % QStandardPaths::writableLocation(QStandardPaths::location) \ % QLatin1Literal("\n\n")).toUtf8()); prnLocInfo(DocumentsLocation); prnLocInfo(FontsLocation); prnLocInfo(ApplicationsLocation); prnLocInfo(MusicLocation); prnLocInfo(MoviesLocation); prnLocInfo(PicturesLocation); prnLocInfo(TempLocation); prnLocInfo(HomeLocation); prnLocInfo(DataLocation); prnLocInfo(CacheLocation); prnLocInfo(GenericDataLocation); prnLocInfo(RuntimeLocation); prnLocInfo(ConfigLocation); prnLocInfo(DownloadLocation); prnLocInfo(GenericCacheLocation); prnLocInfo(GenericConfigLocation); prnLocInfo(AppDataLocation); prnLocInfo(AppLocalDataLocation); outFile.flush(); outFile.close(); return 0; }
And here the result:
System info: buildAbi = x86_64-little_endian-llp64 buildCpuArchitecture = x86_64 currentCpuArchitecture = x86_64 kernelType = winnt kernelVersion = 6.1.7601 prettyProductName = Windows 7 productType = windows productVersion = 7 Qt version = 5.4.0 DocumentsLocation: displayName = Documents standardLocations = C:/Users/user/Documents writableLocation = C:/Users/user/Documents FontsLocation: displayName = Fonts standardLocations = C:/Windows/Fonts writableLocation = C:/Windows/Fonts ApplicationsLocation: displayName = Applications standardLocations = C:/Users/user/AppData/Roaming/Microsoft/Windows/Start Menu/Programs writableLocation = C:/Users/user/AppData/Roaming/Microsoft/Windows/Start Menu/Programs MusicLocation: displayName = Music standardLocations = C:/Users/user/Music writableLocation = C:/Users/user/Music MoviesLocation: displayName = Movies standardLocations = C:/Users/user/Videos writableLocation = C:/Users/user/Videos PicturesLocation: displayName = Pictures standardLocations = C:/Users/user/Pictures writableLocation = C:/Users/user/Pictures TempLocation: displayName = Temporary Directory standardLocations = C:/Users/user/AppData/Local/Temp writableLocation = C:/Users/user/AppData/Local/Temp HomeLocation: displayName = Home standardLocations = C:/Users/user writableLocation = C:/Users/user DataLocation: displayName = Application Data standardLocations = C:/Users/user/AppData/Local/testQStandardPaths standardLocations = C:/Users/user/AppData/Local/testQStandardPaths standardLocations = D:/Projects/build-testQStandardPaths-x64-Release/release standardLocations = D:/Projects/build-testQStandardPaths-x64-Release/release/data writableLocation = C:/Users/user/AppData/Local/testQStandardPaths CacheLocation: displayName = Cache standardLocations = C:/Users/user/AppData/Local/testQStandardPaths/cache writableLocation = C:/Users/user/AppData/Local/testQStandardPaths/cache GenericDataLocation: displayName = Shared Data standardLocations = C:/Users/user/AppData/Local standardLocations = C:/Users/user/AppData/Local writableLocation = C:/Users/user/AppData/Local RuntimeLocation: displayName = Runtime standardLocations = C:/Users/user writableLocation = C:/Users/user ConfigLocation: displayName = Configuration standardLocations = C:/Users/user/AppData/Local/testQStandardPaths standardLocations = C:/Users/user/AppData/Local/testQStandardPaths standardLocations = D:/Projects/build-testQStandardPaths-x64-Release/release standardLocations = D:/Projects/build-testQStandardPaths-x64-Release/release/data writableLocation = C:/Users/user/AppData/Local/testQStandardPaths DownloadLocation: displayName = Download standardLocations = C:/Users/user/Downloads writableLocation = C:/Users/user/Downloads GenericCacheLocation: displayName = Shared Cache standardLocations = C:/Users/user/AppData/Local/cache writableLocation = C:/Users/user/AppData/Local/cache GenericConfigLocation: displayName = Shared Configuration standardLocations = C:/Users/user/AppData/Local standardLocations = C:/Users/user/AppData/Local standardLocations = D:/Projects/build-testQStandardPaths-x64-Release/release standardLocations = D:/Projects/build-testQStandardPaths-x64-Release/release/data writableLocation = C:/Users/user/AppData/Local AppDataLocation: displayName = Application Data standardLocations = C:/Users/user/AppData/Roaming/testQStandardPaths standardLocations = C:/Users/user/AppData/Roaming/testQStandardPaths standardLocations = D:/Projects/build-testQStandardPaths-x64-Release/release standardLocations = D:/Projects/build-testQStandardPaths-x64-Release/release/data writableLocation = C:/Users/user/AppData/Roaming/testQStandardPaths AppLocalDataLocation: displayName = Application Data standardLocations = C:/Users/user/AppData/Local/testQStandardPaths standardLocations = C:/Users/user/AppData/Local/testQStandardPaths standardLocations = D:/Projects/build-testQStandardPaths-x64-Release/release standardLocations = D:/Projects/build-testQStandardPaths-x64-Release/release/data writableLocation = C:/Users/user/AppData/Local/testQStandardPaths
Attachments
For Gerrit Dashboard: QTBUG-44348 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
108298,2 | qtdiag: Update to output values of newly added API. | 5.5 | qt/qttools | Status: MERGED | +2 | 0 |