Skip to content

Commit

Permalink
Merge pull request #491 from jsakkine/master
Browse files Browse the repository at this point in the history
linux: Restore datapath and userDataPath calculations. Closes #487
  • Loading branch information
baconpaul authored Feb 4, 2019
2 parents ee25e8f + c548845 commit 3057df5
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/common/SurgeStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ SurgeStorage::SurgeStorage()

memset(&audio_in[0][0], 0, 2 * BLOCK_SIZE_OS * sizeof(float));

#if MAC || LINUX
const char* homePath = getenv("HOME");
if (!homePath)
throw Surge::Error("The environment variable HOME does not exist",
"Surge failed to initialize");
#endif

#if MAC
char path[1024];
FSRef foundRef;
Expand All @@ -161,8 +168,16 @@ SurgeStorage::SurgeStorage()
}

// ~/Documents/Surge in full name
sprintf( path, "%s/Documents/Surge", getenv( "HOME" ) );
sprintf(path, "%s/Documents/Surge", homePath);
userDataPath = path;
#elif LINUX
const char* xdgDataPath = getenv("XDG_DATA_HOME");
if (xdgDataPath)
datapath = std::string(xdgDataPath) + "/Surge/";
else
datapath = std::string(homePath) + "/.local/share/Surge/";

userDataPath = std::string(homePath) + "/Documents/Surge";
#elif WINDOWS
PWSTR localAppData;
if (!SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, nullptr, &localAppData))
Expand Down

0 comments on commit 3057df5

Please sign in to comment.