Expand environment strings on Windows (allow %temp% in paths), and use system temp directory on Windows for Cache#6482
Conversation
…mp% = C:\users\userna~1\Appdata\Local\Temp) Replace most uses of utf8_to_utf16_string_alloc with utf8_to_utf16_string_alloc_expand_environment_strings
|
Hi there, looks like a good addition. Since this is touching upon UTF8 codeparts, I will invite @bparker06 into the conversation and let him quickly review the changes made to this. |
|
I will need some time to test this, especially with non-ascii language systems and on older Windows versions like 9x. Also, 9x versions' |
|
I think the RA installer package should use the platform defined storage locations, so RA should be installed in Program Files like a regular app and the default dirs would default to dirs inside appdata. That said, a portable mode (like the one we have now) should remain, the usual method is having a portable.ini file alongside with the RA executable. I usually use a userdata dir inside my RA dir for my data. All this being said. This has to be tested very thoroughly imho. |
|
@fr500 The installer would be totally unrelated to this PR, we currently use the default user storage location, which is inside AppData on Vista and up. If we had an option to "install for all users" then we could have that default to Program Files like you said. |
|
Yeah that's actually what I mean, install for all users would use program files for the exe, the dependencies, and hard assets that never need updating (I don't think we have any of those) Then on first startup defaults would be set to Whatever happens, please retain the ability to have a portable installation |
|
@Dwedit Well the first thing I noticed is that it doesn't seem to work :/ This is on a Windows 10 FCU system with CP932 locale (but the value of TEMP does not contain any non-ascii chars). The Also I think we should not be modifying people's existing cache folder settings as this seems to do... a new default is one thing (and @twinaphex still needs to be ok with that), but some people expect the cache to be in a specific place and we shouldn't mess with that if it has already been set. It also shows up in the menu with the wrong slashes, e.g. all the other paths on that page use a Thoughts? |
|
Currently, on the shipping version of RetroArch, the default Cache directory is Blank, meaning store stuff in the main RetroArch folder (not a subdirectory). The change was to change the default Blank value into something else. If a value is configured, it won't change. And that's weird that the path expansion would fail, it's expanding the paths fine on my system. (CP932 code page system) When I stick debugger breakpoints in MSVC, it shows the expanded paths in memory. Preprocessor issues? Does it even execute ExpandEnvironmentStringsW? Wrong slashes? Okay, that's a cosmetic issue.... Win32 allows you to use either kind of slash interchangeably. I wasn't sure whether I needed a terminating slash or not. Easy to change that. |
|
This is strange, I repeated the same test on the same machine and now it's working... I'll test some MSVC builds and other Windows versions next and see if anything comes up. |
|
This PR has conflicts. |
Description
This is a change for RetroArch to allow use of environment variables (such as %temp%) in path names on Windows.
The default Cache directory is also now set on Windows to be "%temp%/retroarch_temp/", rather than defaulting to the RetroArch directory.
On a typical system, %temp% is "C:\users\username\appdata\local\temp"
Use of the %temp% environment variable vs a call to get the system temp directory allows the same installation to be used by multiple users without temp files getting created into another user's temp directory.
Related Issues
Fixes #6438, and addresses part of #6458