19 uint64_t freeBytesAvailable = 0;
20 int replyStatus =
ST_OK;
21 QString replyMessage = tr(
"A new data directory will be created.");
24 fs::path parentDir = dataDir;
25 fs::path parentDirOld = fs::path();
26 while(parentDir.has_parent_path() && !
fs::exists(parentDir))
28 parentDir = parentDir.parent_path();
31 if (parentDirOld == parentDir)
34 parentDirOld = parentDir;
38 freeBytesAvailable = fs::space(parentDir).available;
41 if(fs::is_directory(dataDir))
43 QString separator =
"<code>" + QDir::toNativeSeparators(
"/") + tr(
"name") +
"</code>";
45 replyMessage = tr(
"Directory already exists. Add %1 if you intend to create a new directory here.").arg(separator);
48 replyMessage = tr(
"Path already exists, and is not a directory.");
51 }
catch (
const fs::filesystem_error&)
55 replyMessage = tr(
"Cannot create data directory here.");
57 Q_EMIT
reply(replyStatus, replyMessage, freeBytesAvailable);
virtual QString getPathToCheck()=0
void reply(int status, const QString &message, quint64 available)
static bool exists(const path &p)
fs::path QStringToPath(const QString &path)
Convert QString to OS specific boost path through UTF-8.