[v2,3/6] Move mkdir_recursive to common/filestuff.c
Commit Message
On 2018-10-30 4:55 p.m., Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@ericsson.com> writes:
>
> Simon> What do you think about this?
>
> Thanks for doing this.
>
> Simon> /* See common/pathstuff.h. */
>
> Simon> +std::string
> Simon> +get_standard_temp_dir ()
> Simon> +{
> Simon> +#ifdef WIN32
> Simon> + char *tmp = getenv ("TMP");
> Simon> + if (tmp != nullptr)
> Simon> + return tmp;
> Simon> +
> Simon> + tmp = getenv ("TEMP");
> Simon> + if (tmp != nullptr)
> Simon> + return tmp;
> Simon> +
> Simon> + error (_("Couldn't find temp dir path, both TMP and TEMP are unset."));
> Simon> +
> Simon> +#else
> Simon> + return "/tmp";
>
> It would be normal to look at TMPDIR on unix systems.
Ah, indeed. How is it with this little fixup on top of the patch?
From e8b9d0eabfb9bd85afcf42af9bdfb6a5bde66fc2 Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@ericsson.com>
Date: Tue, 30 Oct 2018 17:01:50 -0400
Subject: [PATCH] fixup
---
gdb/common/pathstuff.c | 4 ++++
gdb/common/pathstuff.h | 5 +++--
2 files changed, 7 insertions(+), 2 deletions(-)
--
2.19.1
Comments
>>>>> "Simon" == Simon Marchi <simon.marchi@ericsson.com> writes:
>> It would be normal to look at TMPDIR on unix systems.
Simon> Ah, indeed. How is it with this little fixup on top of the patch?
Seems reasonable, thanks!
Simon> + char *tmp = getenv ("TMPDIR");
A tiny nit: you can use const char * here.
Tom
On 2018-10-31 11:03, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@ericsson.com> writes:
>
>>> It would be normal to look at TMPDIR on unix systems.
>
> Simon> Ah, indeed. How is it with this little fixup on top of the
> patch?
>
> Seems reasonable, thanks!
>
> Simon> + char *tmp = getenv ("TMPDIR");
>
> A tiny nit: you can use const char * here.
>
> Tom
Pushed with that fixed, thanks!
Simon
@@ -208,6 +208,10 @@ get_standard_temp_dir ()
error (_("Couldn't find temp dir path, both TMP and TEMP are unset."));
#else
+ char *tmp = getenv ("TMPDIR");
+ if (tmp != nullptr)
+ return tmp;
+
return "/tmp";
#endif
}
@@ -68,8 +68,9 @@ extern std::string get_standard_cache_dir ();
/* Get the usual temporary directory for the current platform.
- On Windows, this is the TMP or TEMP environment variable. On the rest,
- it's /tmp.
+ On Windows, this is the TMP or TEMP environment variable.
+
+ On the rest, this is the TMPDIR environment variable, if defined, else /tmp.
Throw an exception on error. */