Add new default ADEPT directories : /home/<user>/.config/adept and $ADEPT_DIR environment variable

This commit is contained in:
2023-01-05 21:29:55 +01:00
parent 937c27fc23
commit ab5afa5003
8 changed files with 63 additions and 16 deletions

View File

@@ -61,6 +61,20 @@ bool fileExists(const char* filename)
const char* findFile(const char* filename, bool inDefaultDirs)
{
std::string path;
const char* adeptDir = getenv("ADEPT_DIR");
if (adeptDir && adeptDir[0])
{
path = adeptDir + std::string("/") + filename;
if (fileExists(path.c_str()))
return strdup(path.c_str());
}
path = gourou::DRMProcessor::getDefaultAdeptDir() + filename;
if (fileExists(path.c_str()))
return strdup(path.c_str());
if (fileExists(filename))
return strdup(filename);
@@ -68,7 +82,7 @@ const char* findFile(const char* filename, bool inDefaultDirs)
for (int i=0; i<(int)ARRAY_SIZE(defaultDirs); i++)
{
std::string path = std::string(defaultDirs[i]) + filename;
path = std::string(defaultDirs[i]) + filename;
if (fileExists(path.c_str()))
return strdup(path.c_str());
}