/ Create a directory if it doesn't exist. */ /
| 153 | /* Create a directory if it doesn't exist. */ |
| 154 | /*************************************************/ |
| 155 | void FileManager::createDirOrCheckWriteable(QDir dir) { |
| 156 | |
| 157 | if (!dir.exists()) { |
| 158 | if (!dir.mkdir(dir.path())) { |
| 159 | QLOG_FATAL() << "Failed to create directory '" << dir.path() << "'. Aborting program."; |
| 160 | exit(16); |
| 161 | } |
| 162 | } else { |
| 163 | if (!dir.isReadable()) { |
| 164 | QLOG_FATAL() << "Directory '" + dir.path() + "' does not have read permission. Aborting program."; |
| 165 | exit(16); |
| 166 | } |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | |
| 171 | /**************************************************/ |