| 1123 | |
| 1124 | |
| 1125 | QString 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 | |
| 1166 | QString Application::defaultProjectFolderPath() |