6#ifndef QT_NO_STANDARDPATHS
9#include <qcoreapplication.h>
14#include <FindDirectory.h>
16#include <PathFinder.h>
17#include <StringList.h>
25#ifndef QT_BOOTSTRAPPED
26 const QString org = QCoreApplication::organizationName();
29 const QString appName = QCoreApplication::applicationName();
30 if (!appName.isEmpty())
31 path += u'/' + appName;
38
39
44 if (find_directory(which, &standardPath,
false) != B_OK)
47 return QFile::decodeName(standardPath.Path());
51
52
57 if (BPathFinder::FindPaths(baseDirectory, paths) != B_OK)
60 QStringList standardPaths;
61 for (
int i = 0; i < paths.CountStrings(); ++i) {
62 standardPaths << QFile::decodeName(paths.StringAt(i).String());
69
70
73 QString path = haikuStandardPath(which);
75 appendOrganizationAndApp(path);
81
82
85 QStringList paths = haikuStandardPaths(baseDirectory);
86 for (
int i = 0; i < paths.count(); ++i)
94QString QStandardPaths::writableLocation(StandardLocation type)
98 return haikuStandardPath(B_DESKTOP_DIRECTORY);
99 case DocumentsLocation:
100 case PicturesLocation:
103 case DownloadLocation:
104 case PublicShareLocation:
105 case TemplatesLocation:
107 return haikuStandardPath(B_USER_DIRECTORY);
109 return haikuStandardPath(B_USER_NONPACKAGED_FONTS_DIRECTORY);
110 case ApplicationsLocation:
111 return haikuStandardPath(B_USER_NONPACKAGED_BIN_DIRECTORY);
113 return haikuStandardPath(B_SYSTEM_TEMP_DIRECTORY);
114 case AppDataLocation:
115 case AppLocalDataLocation:
116 return haikuAppStandardPath(B_USER_NONPACKAGED_DATA_DIRECTORY);
117 case GenericDataLocation:
118 return haikuStandardPath(B_USER_NONPACKAGED_DATA_DIRECTORY);
120 return haikuAppStandardPath(B_USER_CACHE_DIRECTORY);
121 case GenericCacheLocation:
122 return haikuStandardPath(B_USER_CACHE_DIRECTORY);
124 case AppConfigLocation:
126 case GenericStateLocation:
127 return haikuAppStandardPath(B_USER_SETTINGS_DIRECTORY);
128 case GenericConfigLocation:
129 return haikuStandardPath(B_USER_SETTINGS_DIRECTORY);
135QStringList QStandardPaths::standardLocations(StandardLocation type)
139 const QString writablePath = writableLocation(type);
140 if (!writablePath.isEmpty())
141 paths += writablePath;
144 case DocumentsLocation:
145 case PicturesLocation:
148 case DownloadLocation:
149 case PublicShareLocation:
150 case TemplatesLocation:
152 paths += haikuStandardPath(B_USER_NONPACKAGED_DIRECTORY);
155 paths += haikuStandardPaths(B_FIND_PATH_FONTS_DIRECTORY);
157 case ApplicationsLocation:
158 paths += haikuStandardPaths(B_FIND_PATH_BIN_DIRECTORY);
159 paths += haikuStandardPaths(B_FIND_PATH_APPS_DIRECTORY);
161 case AppDataLocation:
162 case AppLocalDataLocation:
163 paths += haikuAppStandardPaths(B_FIND_PATH_DATA_DIRECTORY);
165 case GenericDataLocation:
166 paths += haikuStandardPaths(B_FIND_PATH_DATA_DIRECTORY);
169 paths += haikuAppStandardPath(B_SYSTEM_CACHE_DIRECTORY);
171 case GenericCacheLocation:
172 paths += haikuStandardPath(B_SYSTEM_CACHE_DIRECTORY);
175 case AppConfigLocation:
176 paths += haikuAppStandardPath(B_SYSTEM_SETTINGS_DIRECTORY);
178 case GenericConfigLocation:
179 paths += haikuStandardPath(B_SYSTEM_SETTINGS_DIRECTORY);
Combined button and popup list for selecting options.
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)