Skip to content

Commit 201fa73

Browse files
committed
Fix Linux docs dir when $XDG_CONFIG_HOME does not exist
Signed-off-by: falkTX <falktx@falktx.com>
1 parent 50f4a7c commit 201fa73

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

distrho/src/DistrhoUtils.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,10 @@ const char* getPluginFormatName() noexcept
119119
static inline
120120
void _createDirIfNeeded(const char* const dir)
121121
{
122-
if (access(dir, F_OK) != 0)
123-
mkdir(dir, 0755);
122+
try {
123+
if (access(dir, F_OK) != 0)
124+
mkdir(dir, 0755);
125+
} DISTRHO_SAFE_EXCEPTION("createDirIfNeeded");
124126
}
125127
#endif
126128

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

256258
// ${XDG_CONFIG_HOME}/user-dirs.dirs does not exist or has bad data
257259
if (dir.isEmpty())
258-
dir = _getDocumentsDir();
260+
{
261+
dir = _getHomeDir();
262+
dir += "Documents/";
263+
}
259264

260265
_createDirIfNeeded(dir);
261266
#endif

0 commit comments

Comments
 (0)