SpiderPig Posted June 10, 2023 Share Posted June 10, 2023 enum UserPath { PATH_DESKTOP, PATH_DOCUMENTS, PATH_PROGRAMDATA, PATH_APPDATA = PATH_PROGRAMDATA }; I see PATH_APPDATA is currently defined as program data. Should it be? If yes... can we get a path to the Local or Roaming Appdata path for game saves? Quote Link to comment Share on other sites More sharing options...
Josh Posted June 10, 2023 Share Posted June 10, 2023 Why not store this in program data? Are there really going to be multiple users on a computer your game is running, who each play the game and want to make sure their saves are stored separately? Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
SpiderPig Posted June 10, 2023 Author Share Posted June 10, 2023 I never really thought about it like that. I've just all ways used AppData for that purpose. Even so, I think PATH_APPDATA should return the correct path. Quote Link to comment Share on other sites More sharing options...
Josh Posted June 10, 2023 Share Posted June 10, 2023 I stopped using it because it's not cross-platform, and it's really hard to navigate to. Program data is the intended replacement. I'm storing all the engine settings there. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
SpiderPig Posted June 10, 2023 Author Share Posted June 10, 2023 Ah okay, that makes sense. Thanks. Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted June 14 Author Share Posted June 14 @Josh I'd like to revise this suggestion to be able to use GetPath() to get the APP_DATA_ROAMING path. Looking at Steams cloud save system there is no option to have it navigate to the programdata path. These are the available paths for cloud saving. I would rather use the AppData path than the documents path. Also might be an idea to have get the paths on Mac & Linux - when the time comes. Quote Link to comment Share on other sites More sharing options...
Josh Posted June 14 Share Posted June 14 There are two Windows command that do this. With those you can get anything you want. WCHAR szPath[MAX_PATH]; if (SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_COMMON_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, szPath))) { return WString(szPath).Replace("\\", "/"); } PIDLIST_ABSOLUTE pidlist; wchar_t path[MAX_PATH]; SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidlist); SHGetPathFromIDListW(pidlist, path); return WString(path).Replace("\\", "/");; Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
reepblue Posted June 14 Share Posted June 14 This is my code from my API where it grabs whatever system environment you want. I might look into implementing the above as old Win32 API code can cause AV's to get grumpy but I haven't had problems so far. const std::wstring System::GetSystemEnviormentW(const std::string& env) { #ifdef _WIN32 wchar_t* buf = nullptr; size_t sz = 0; std::wstring wenv = String::ToWString(env); // Use _dupenv_s to get the environment variable if (_wdupenv_s(&buf, &sz, wenv.c_str()) == 0 && buf != nullptr) { std::wstring result(buf); free(buf); // Free the allocated buffer return result; } #else auto s = std::getenv(env.c_str()); if (s == NULL) return String::ToWString(s); #endif return L""; // Environment variable not found or error occurred } Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.