mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-08-06 00:00:25 +00:00
Add more Linux known directories
This commit is contained in:
parent
ef142ecd52
commit
3dd2495cee
1 changed files with 35 additions and 0 deletions
|
@ -200,6 +200,10 @@ void GetKnownDirectory(KnownDirectory kD, std::string &path) {
|
||||||
SHGetFolderPathA(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, (char *)path.data());
|
SHGetFolderPathA(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, (char *)path.data());
|
||||||
#else
|
#else
|
||||||
if (envVar) {
|
if (envVar) {
|
||||||
|
path.assign(envVar);
|
||||||
|
path.append("/.config");
|
||||||
|
if (!DirectoryExists(path.c_str()))
|
||||||
|
path.clear();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
@ -209,6 +213,10 @@ void GetKnownDirectory(KnownDirectory kD, std::string &path) {
|
||||||
SHGetFolderPathA(NULL, CSIDL_LOCAL_APPDATA | CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, (char *)path.data());
|
SHGetFolderPathA(NULL, CSIDL_LOCAL_APPDATA | CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, (char *)path.data());
|
||||||
#else
|
#else
|
||||||
if (envVar) {
|
if (envVar) {
|
||||||
|
path.assign(envVar);
|
||||||
|
path.append("/.local/share");
|
||||||
|
if (!DirectoryExists(path.c_str()))
|
||||||
|
path.clear();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
@ -218,6 +226,10 @@ void GetKnownDirectory(KnownDirectory kD, std::string &path) {
|
||||||
SHGetFolderPathA(NULL, CSIDL_COMMON_APPDATA | CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, (char *)path.data());
|
SHGetFolderPathA(NULL, CSIDL_COMMON_APPDATA | CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, (char *)path.data());
|
||||||
#else
|
#else
|
||||||
if (envVar) {
|
if (envVar) {
|
||||||
|
path.assign(envVar);
|
||||||
|
path.append("/.local/share");
|
||||||
|
if (!DirectoryExists(path.c_str()))
|
||||||
|
path.clear();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
@ -227,6 +239,12 @@ void GetKnownDirectory(KnownDirectory kD, std::string &path) {
|
||||||
SHGetFolderPathA(NULL, CSIDL_FONTS | CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, (char *)path.data());
|
SHGetFolderPathA(NULL, CSIDL_FONTS | CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, (char *)path.data());
|
||||||
#else
|
#else
|
||||||
if (envVar) {
|
if (envVar) {
|
||||||
|
path.assign("/usr/share/fonts");
|
||||||
|
if (!DirectoryExists(path.c_str())) {
|
||||||
|
path.assign("/usr/local/share/fonts");
|
||||||
|
if (!DirectoryExists(path.c_str()))
|
||||||
|
path.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
@ -241,6 +259,14 @@ void GetKnownDirectory(KnownDirectory kD, std::string &path) {
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (envVar) {
|
if (envVar) {
|
||||||
|
path.assign(envVar);
|
||||||
|
path.append("/.local/share/fonts");
|
||||||
|
if (!DirectoryExists(path.c_str())) {
|
||||||
|
path.assign(envVar);
|
||||||
|
path.append("/.fonts");
|
||||||
|
if (!DirectoryExists(path.c_str()))
|
||||||
|
path.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
@ -263,8 +289,12 @@ void GetKnownDirectory(KnownDirectory kD, std::string &path) {
|
||||||
SHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES | CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, (char *)path.data());
|
SHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES | CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, (char *)path.data());
|
||||||
#else
|
#else
|
||||||
if (envVar) {
|
if (envVar) {
|
||||||
|
# ifdef QB64_MACOSX
|
||||||
path.assign(envVar);
|
path.assign(envVar);
|
||||||
path.append("/Applications");
|
path.append("/Applications");
|
||||||
|
# else
|
||||||
|
path.assign("/opt");
|
||||||
|
# endif
|
||||||
if (!DirectoryExists(path.c_str()))
|
if (!DirectoryExists(path.c_str()))
|
||||||
path.clear();
|
path.clear();
|
||||||
}
|
}
|
||||||
|
@ -280,8 +310,12 @@ void GetKnownDirectory(KnownDirectory kD, std::string &path) {
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
if (envVar) {
|
if (envVar) {
|
||||||
|
# ifdef QB64_MACOSX
|
||||||
path.assign(envVar);
|
path.assign(envVar);
|
||||||
path.append("/Applications");
|
path.append("/Applications");
|
||||||
|
# else
|
||||||
|
path.assign("/opt");
|
||||||
|
# endif
|
||||||
if (!DirectoryExists(path.c_str()))
|
if (!DirectoryExists(path.c_str()))
|
||||||
path.clear();
|
path.clear();
|
||||||
}
|
}
|
||||||
|
@ -326,6 +360,7 @@ qbs *func__dir(qbs *qbsContext) {
|
||||||
|
|
||||||
std::transform(context.begin(), context.end(), context.begin(), [](unsigned char c) { return std::toupper(c); });
|
std::transform(context.begin(), context.end(), context.begin(), [](unsigned char c) { return std::toupper(c); });
|
||||||
|
|
||||||
|
// The following is largely unchanged from what we previously had
|
||||||
if (context.compare("TEXT") == 0 || context.compare("DOCUMENT") == 0 || context.compare("DOCUMENTS") == 0 || context.compare("MY DOCUMENTS") == 0) {
|
if (context.compare("TEXT") == 0 || context.compare("DOCUMENT") == 0 || context.compare("DOCUMENTS") == 0 || context.compare("MY DOCUMENTS") == 0) {
|
||||||
GetKnownDirectory(KnownDirectory::DOCUMENTS, path);
|
GetKnownDirectory(KnownDirectory::DOCUMENTS, path);
|
||||||
} else if (context.compare("MUSIC") == 0 || context.compare("AUDIO") == 0 || context.compare("SOUND") == 0 || context.compare("SOUNDS") == 0 ||
|
} else if (context.compare("MUSIC") == 0 || context.compare("AUDIO") == 0 || context.compare("SOUND") == 0 || context.compare("SOUNDS") == 0 ||
|
||||||
|
|
Loading…
Reference in a new issue