This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix cache dir resolving on Windows
- From: Eli Zaretskii <eliz at gnu dot org>
- To: orgads at gmail dot com
- Cc: gdb-patches at sourceware dot org, orgads at gmail dot com
- Date: Tue, 04 Jun 2019 17:44:17 +0300
- Subject: Re: [PATCH] Fix cache dir resolving on Windows
- References: <20190603193716.4861-1-orgads@gmail.com>
> From: orgads@gmail.com
> Cc: Orgad Shaneh <orgads@gmail.com>
> Date: Mon, 3 Jun 2019 22:37:16 +0300
>
> From: Orgad Shaneh <orgads@gmail.com>
>
> ... when not running from MSYS environment, and HOME is not set.
> ---
> gdb/common/pathstuff.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/gdb/common/pathstuff.c b/gdb/common/pathstuff.c
> index 2b1669a5b9..edb8a1fcda 100644
> --- a/gdb/common/pathstuff.c
> +++ b/gdb/common/pathstuff.c
> @@ -231,6 +231,10 @@ get_standard_cache_dir ()
> #endif
>
> const char *home = getenv ("HOME");
> +#ifdef _WIN32
> + if (home == nullptr)
> + home = getenv ("USERPROFILE");
> +#endif
> if (home != NULL)
This is against the MS platform recommendations regarding "known
folders", see
https://docs.microsoft.com/en-us/windows/desktop/shell/knownfolderid
https://docs.microsoft.com/en-us/windows/desktop/shell/csidl
But maybe we don't care about that. I know that many applications
ported from Unix don't.