27 #include <QApplication>
33 std::string InstallDirs::g_data_dir;
34 std::string InstallDirs::g_root_dir;
35 std::string InstallDirs::g_workspace_dir;
36 bool InstallDirs::g_initialized =
false;
39 inline void InstallDirs::Check()
46 void InstallDirs::Initialize()
50 QDir dir(QApplication::applicationDirPath());
52 #if defined(__APPLE__)
53 if (dir.dirName() ==
"MacOS") {
61 if (dir.dirName().toLower() ==
"debug" || dir.dirName().toLower() ==
"release") {
69 #if defined(__WIN32__)
70 if (dir.dirName() !=
"bin") {
81 const bool exists = dir.exists();
82 const string path = dir.absolutePath().toStdString();
83 g_root_dir = (exists) ? dir.absolutePath().toStdString() :
"";
87 QDir dir(QString::fromStdString(g_root_dir));
88 const bool exists = dir.cd(
"data");
89 g_data_dir = (exists) ? dir.absolutePath().toStdString() :
"";
93 QDir dir(QString::fromStdString(g_data_dir));
94 const bool exists = dir.cd(
"simPT_Default_workspace");
95 const string path = dir.absolutePath().toStdString();
96 g_workspace_dir = (exists) ? dir.absolutePath().toStdString() :
"";
102 string InstallDirs::GetDataDir()
108 string InstallDirs::GetRootDir()
114 string InstallDirs::GetWorkspaceDir()
117 return g_workspace_dir;
Namespace for generic graphical shell for simulators.