summaryrefslogtreecommitdiff
path: root/ext/File-Glob/bsd_glob.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/File-Glob/bsd_glob.c')
-rw-r--r--ext/File-Glob/bsd_glob.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/ext/File-Glob/bsd_glob.c b/ext/File-Glob/bsd_glob.c
index f891d29c0c..89d51af64c 100644
--- a/ext/File-Glob/bsd_glob.c
+++ b/ext/File-Glob/bsd_glob.c
@@ -457,6 +457,7 @@ globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob_t *pglob)
/*
* handle a plain ~ or ~/ by expanding $HOME
* first and then trying the password file
+ * or $USERPROFILE on DOSISH systems
*/
if ((h = getenv("HOME")) == NULL) {
#ifdef HAS_PASSWD
@@ -465,6 +466,14 @@ globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob_t *pglob)
return pattern;
else
h = pwd->pw_dir;
+#elif DOSISH
+ /*
+ * When no passwd file, fallback to the USERPROFILE
+ * environment variable on DOSish systems.
+ */
+ if ((h = getenv("USERPROFILE")) == NULL) {
+ return pattern;
+ }
#else
return pattern;
#endif