2018-07-14 06:06:33 +00:00
|
|
|
#include "Common.hpp"
|
|
|
|
#include <QMessageBox>
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
boo::SystemString QStringToSysString(const QString& str)
|
|
|
|
{
|
|
|
|
#ifdef _WIN32
|
|
|
|
return (wchar_t*)str.utf16();
|
|
|
|
#else
|
|
|
|
return str.toUtf8().toStdString();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
QString SysStringToQString(const boo::SystemString& str)
|
|
|
|
{
|
|
|
|
#ifdef _WIN32
|
|
|
|
return QString::fromStdWString(str);
|
|
|
|
#else
|
|
|
|
return QString::fromStdString(str);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2018-07-17 04:48:38 +00:00
|
|
|
bool MkPath(const QString& path, UIMessenger& messenger)
|
2018-07-14 06:06:33 +00:00
|
|
|
{
|
|
|
|
QFileInfo fInfo(path);
|
2018-07-17 04:48:38 +00:00
|
|
|
return MkPath(fInfo.dir(), fInfo.fileName(), messenger);
|
2018-07-14 06:06:33 +00:00
|
|
|
}
|
|
|
|
|
2018-07-17 04:48:38 +00:00
|
|
|
bool MkPath(const QDir& dir, const QString& file, UIMessenger& messenger)
|
2018-07-14 06:06:33 +00:00
|
|
|
{
|
|
|
|
if (!dir.mkpath(file))
|
|
|
|
{
|
2018-07-17 04:48:38 +00:00
|
|
|
QString msg = QString(QObject::tr("A directory at '%1/%2' could not be created.")).arg(dir.path()).arg(file);
|
|
|
|
messenger.critical(QObject::tr("Unable to create directory"), msg);
|
2018-07-14 06:06:33 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|