Project

General

Profile

Feature #693389

Windows: just use getenv(APPDATA) for home dir

Added by Jacob Nevins almost 2 years ago. Updated about 22 hours ago.

Status:
Closed
Priority:
Normal
Category:
General
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

(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.

History

#1 Updated by Marko Lindqvist about 1 year ago

There's an proposed fix by simsulla at https://github.com/freeciv/freeciv/pull/10

I would still make use of APPDATA environment variable #ifdef FREECIV_MSWINDOWS only.

#2 Updated by Sim Sulla about 1 year ago

Made it only applicable for FREECIV_MSWINDOWS, see pull request.

#3 Updated by Marko Lindqvist about 1 year ago

Combined related commits into one patch. Applies both to master and S3_0.

#4 Updated by Marko Lindqvist 11 months ago

  • Status changed from Resolved to Closed
  • Assignee set to Marko Lindqvist

Also available in: Atom PDF