7#ifndef QT_NO_STANDARDPATHS
10#include <qcoreapplication.h>
15#include <FindDirectory.h>
17#include <PathFinder.h>
18#include <StringList.h>
26#ifndef QT_BOOTSTRAPPED
27 const QString org = QCoreApplication::organizationName();
30 const QString appName = QCoreApplication::applicationName();
31 if (!appName.isEmpty())
32 path += u'/' + appName;
39
40
45 if (find_directory(which, &standardPath,
false) != B_OK)
48 return QFile::decodeName(standardPath.Path());
52
53
58 if (BPathFinder::FindPaths(baseDirectory, paths) != B_OK)
61 QStringList standardPaths;
62 for (
int i = 0; i < paths.CountStrings(); ++i) {
63 standardPaths << QFile::decodeName(paths.StringAt(i).String());
70
71
74 QString path = haikuStandardPath(which);
76 appendOrganizationAndApp(path);
82
83
86 QStringList paths = haikuStandardPaths(baseDirectory);
87 for (
int i = 0; i < paths.count(); ++i)
95QString QStandardPaths::writableLocation(StandardLocation type)
99 return haikuStandardPath(B_DESKTOP_DIRECTORY);
100 case DocumentsLocation:
101 case PicturesLocation:
104 case DownloadLocation:
105 case PublicShareLocation:
106 case TemplatesLocation:
108 return haikuStandardPath(B_USER_DIRECTORY);
110 return haikuStandardPath(B_USER_NONPACKAGED_FONTS_DIRECTORY);
111 case ApplicationsLocation:
112 return haikuStandardPath(B_USER_NONPACKAGED_BIN_DIRECTORY);
114 return haikuStandardPath(B_SYSTEM_TEMP_DIRECTORY);
115 case AppDataLocation:
116 case AppLocalDataLocation:
117 return haikuAppStandardPath(B_USER_NONPACKAGED_DATA_DIRECTORY);
118 case GenericDataLocation:
119 return haikuStandardPath(B_USER_NONPACKAGED_DATA_DIRECTORY);
121 return haikuAppStandardPath(B_USER_CACHE_DIRECTORY);
122 case GenericCacheLocation:
123 return haikuStandardPath(B_USER_CACHE_DIRECTORY);
125 case AppConfigLocation:
127 case GenericStateLocation:
128 return haikuAppStandardPath(B_USER_SETTINGS_DIRECTORY);
129 case GenericConfigLocation:
130 return haikuStandardPath(B_USER_SETTINGS_DIRECTORY);
136QStringList QStandardPaths::standardLocations(StandardLocation type)
140 const QString writablePath = writableLocation(type);
141 if (!writablePath.isEmpty())
142 paths += writablePath;
145 case DocumentsLocation:
146 case PicturesLocation:
149 case DownloadLocation:
150 case PublicShareLocation:
151 case TemplatesLocation:
153 paths += haikuStandardPath(B_USER_NONPACKAGED_DIRECTORY);
156 paths += haikuStandardPaths(B_FIND_PATH_FONTS_DIRECTORY);
158 case ApplicationsLocation:
159 paths += haikuStandardPaths(B_FIND_PATH_BIN_DIRECTORY);
160 paths += haikuStandardPaths(B_FIND_PATH_APPS_DIRECTORY);
162 case AppDataLocation:
163 case AppLocalDataLocation:
164 paths += haikuAppStandardPaths(B_FIND_PATH_DATA_DIRECTORY);
166 case GenericDataLocation:
167 paths += haikuStandardPaths(B_FIND_PATH_DATA_DIRECTORY);
170 paths += haikuAppStandardPath(B_SYSTEM_CACHE_DIRECTORY);
172 case GenericCacheLocation:
173 paths += haikuStandardPath(B_SYSTEM_CACHE_DIRECTORY);
176 case AppConfigLocation:
177 paths += haikuAppStandardPath(B_SYSTEM_SETTINGS_DIRECTORY);
179 case GenericConfigLocation:
180 paths += haikuStandardPath(B_SYSTEM_SETTINGS_DIRECTORY);
QString haikuAppStandardPath(directory_which which)
QString haikuStandardPath(directory_which which)
void appendOrganizationAndApp(QString &path)
QStringList haikuStandardPaths(path_base_directory baseDirectory)
QStringList haikuAppStandardPaths(path_base_directory baseDirectory)