MCPcopy Create free account
hub / github.com/c3d/tao3D / defaultUserDocumentsFolderPath

Method defaultUserDocumentsFolderPath

tao/application.cpp:1125–1163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1123
1124
1125QString Application::defaultUserDocumentsFolderPath()
1126// ----------------------------------------------------------------------------
1127// Try to guess the best documents folder to use by default
1128// ----------------------------------------------------------------------------
1129{
1130#ifdef CONFIG_MINGW
1131 // Looking at the Windows registry
1132 QSettings settings(
1133 "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows"
1134 "\\CurrentVersion\\Explorer",
1135 QSettings::NativeFormat);
1136
1137 // For Windows Vista/7
1138 // Typically C:\Users\username\Documents
1139 // For Windows XP
1140 // Typically C:\Documents and Settings\username\My Documents
1141 QString path = settings.value("User Shell Folders\\Personal").toString();
1142
1143 if (!path.isNull())
1144 {
1145 return QDir::toNativeSeparators(path);
1146 }
1147
1148#endif // CONFIG_MINGW
1149
1150 // Trying to find a home sub-directory ending with "Documents"
1151 QFileInfoList list = QDir::home().entryInfoList(
1152 QDir::NoDotAndDotDot | QDir::Dirs );
1153 for (int i = 0; i < list.size(); i++)
1154 {
1155 QFileInfo info = list[i];
1156 if (info.fileName().endsWith("documents", Qt::CaseInsensitive))
1157 {
1158 return QDir::toNativeSeparators(info.absoluteFilePath());
1159 }
1160 }
1161 // Last default would be home itself
1162 return QDir::toNativeSeparators(QDir::homePath());
1163}
1164
1165
1166QString Application::defaultProjectFolderPath()

Callers

nothing calls this directly

Calls 4

isNullMethod · 0.80
fileNameMethod · 0.80
toStringMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected