Browse Source

Change user dir on Windows to AppData/Local/Rack2.

tags/v2.5.0
Andrew Belt 7 months ago
parent
commit
35cc54c540
1 changed files with 15 additions and 7 deletions
  1. +15
    -7
      src/asset.cpp

+ 15
- 7
src/asset.cpp View File

@@ -108,15 +108,23 @@ static void initUserDir() {
std::string oldUserDir;

#if defined ARCH_WIN
// Get "My Documents" path
wchar_t documentsBufW[MAX_PATH] = L".";
HRESULT result = SHGetFolderPathW(NULL, CSIDL_MYDOCUMENTS, NULL, SHGFP_TYPE_CURRENT, documentsBufW);
assert(result == S_OK);
// Get AppData/Local path
WCHAR localBufW[MAX_PATH] = {};
HRESULT localH = SHGetFolderPathW(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, localBufW);
assert(SUCCEEDED(localH));
std::string localDir = string::UTF16toUTF8(localBufW);

// Rack <2.5.0 used "My Documents/Rack2"
oldUserDir = system::join(string::UTF16toUTF8(documentsBufW), "Rack" + APP_VERSION_MAJOR);
// Usually C:/Users/<username>/AppData/Local/Rack2
userDir = system::join(localDir, "Rack" + APP_VERSION_MAJOR);

// Get Documents path
WCHAR documentsBufW[MAX_PATH] = {};
HRESULT documentsH = SHGetFolderPathW(NULL, CSIDL_MYDOCUMENTS, NULL, SHGFP_TYPE_CURRENT, documentsBufW);
assert(SUCCEEDED(documentsH));
std::string documentsDir = string::UTF16toUTF8(documentsBufW);

// TODO new userDir
// Rack <2.5.0 used "My Documents/Rack2"
oldUserDir = system::join(documentsDir, "Rack" + APP_VERSION_MAJOR);
#endif

#if defined ARCH_MAC


Loading…
Cancel
Save