Skip to content

Commit

Permalink
Fix a logic error in creating Surge XT folder in new session
Browse files Browse the repository at this point in the history
In a new session, Surge XT would not accurately create
a user folder. Correct this.
  • Loading branch information
baconpaul committed Aug 11, 2024
1 parent fa13f6b commit 9e684c4
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions src/common/SurgeStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,30 +348,12 @@ SurgeStorage::SurgeStorage(const SurgeStorage::SurgeStorageConfig &config) : oth
* This code doesn't work because fs:: doesn't have a writable check and I don't
* want to create a file just to see in every startup path. We find out later
* anyway when we set up the directories.
auto stat = fs::status(userDataPath);
std::cout << std::oct << (int)stat.permissions() << " " << (int)fs::perms::owner_write
<< std::endl; if ((stat.permissions() & fs::perms::owner_write) != fs::perms::none)
{
userDataPathValid = true;
}
else
{
reportError(std::string() + "Your user directory '" + userDataPath.u8string() + "'
is not writable.", "Path Error");
}
*/
}
else
{
reportError(std::string() + "Your user directory '" + userDataPath.u8string() +
"' is not a directory.",
"Path Error");
}
}
catch (const fs::filesystem_error &e)
{
userDataPathValid = false;
reportError(e.what(), "Path Error");
}

userDefaultFilePath = userDataPath;
Expand Down Expand Up @@ -399,7 +381,7 @@ SurgeStorage::SurgeStorage(const SurgeStorage::SurgeStorageConfig &config) : oth
extraThirdPartyWavetablesPath = config.extraThirdPartyWavetablesPath;
extraUserWavetablesPath = config.extraUsersWavetablesPath;

if (config.createUserDirectory && userDataPathValid)
if (config.createUserDirectory && !userDataPathValid)
{
createUserDirectory();
}
Expand Down

0 comments on commit 9e684c4

Please sign in to comment.