Windows: just use getenv(APPDATA) for home dir
(re-raising gna patch #7381)
cazfi: In patch #7378 comments Frank <dunnoob> proposes using getenv(APPDATA) in Windows instead of our current home dir resolving code.
Frank's original comments from #7378:
Those 2004 and 2008 special folder recipes are rather obscure, you could ignore it and simply try getenv(APPDATA). If that doesn't exist it's the same situation as for a missing getenv(HOME) on other platforms, just give up producing an error message on stderr (or whatever GUI applications do, the Windows kernl contains a msgbox popup with system icons + sounds for error/warning/info etc.).
And if APPDATA exists, but turns out to be no writable directory, just also give up: APPDATA or HOME is just required, no guessing, no tricks, no vintage 2008 blog posts presumably tested on XP or W2K when freeciv still worked on XP or W2K.
You could also trust that HOMEDRIVE and HOMEPATH always exist, but then you'd end up in another emulation of HOME above APPDATA (git among other tries this.)
JN new comments: the minimum Windows version supported by any of our builds at the moment is Vista, so as Frank says, we don't need to worry about whether APPDATA is reliable on older Windows than that.
I think we had any number of other open bugs complaining about home directory detection, but I haven't gone looking for them.
#3 Updated by Marko Lindqvist about 1 year ago
- File 0009-Windows-just-use-getenv-APPDATA-for-home-dir.patch 0009-Windows-just-use-getenv-APPDATA-for-home-dir.patch added
- Category changed from Windows Installers to General
- Status changed from New to Resolved
Combined related commits into one patch. Applies both to master and S3_0.