Skip to content

Commit

Permalink
use CREATE_NEW to make this more right
Browse files Browse the repository at this point in the history
  • Loading branch information
carlos-zamora committed Nov 4, 2020
1 parent f6ad218 commit 31dd278
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,7 @@ const Json::Value& CascadiaSettings::_GetDisabledProfileSourcesJsonObject(const

// Method Description:
// - Write the current state of CascadiaSettings to our settings file
// - Create a backup file with the current contents
// - Create a backup file with the current contents, if one does not exist
// Arguments:
// - <none>
// Return Value:
Expand All @@ -1054,10 +1054,10 @@ void CascadiaSettings::WriteSettingsToDisk() const
GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE,
nullptr,
OPEN_EXISTING,
CREATE_NEW,
FILE_ATTRIBUTE_NORMAL,
nullptr) };
if (!backupFile)
if (GetLastError() != ERROR_FILE_EXISTS)
{
_WriteSettings(_userSettingsString, backupSettingsPath);
}
Expand Down

0 comments on commit 31dd278

Please sign in to comment.