Browse Source

Fix Linux docs dir when $XDG_CONFIG_HOME does not exist

Signed-off-by: falkTX <falktx@falktx.com>
pull/506/head
falkTX 2 months ago
parent
commit
201fa7387a
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
1 changed files with 8 additions and 3 deletions
  1. +8
    -3
      distrho/src/DistrhoUtils.cpp

+ 8
- 3
distrho/src/DistrhoUtils.cpp View File

@@ -119,8 +119,10 @@ const char* getPluginFormatName() noexcept
static inline
void _createDirIfNeeded(const char* const dir)
{
if (access(dir, F_OK) != 0)
mkdir(dir, 0755);
try {
if (access(dir, F_OK) != 0)
mkdir(dir, 0755);
} DISTRHO_SAFE_EXCEPTION("createDirIfNeeded");
}
#endif

@@ -255,7 +257,10 @@ static const char* _getDocumentsDir()

// ${XDG_CONFIG_HOME}/user-dirs.dirs does not exist or has bad data
if (dir.isEmpty())
dir = _getDocumentsDir();
{
dir = _getHomeDir();
dir += "Documents/";
}

_createDirIfNeeded(dir);
#endif


Loading…
Cancel
Save