aboutsummaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/utils.c b/src/utils.c
index 367c0f5..6a32bda 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -1,7 +1,7 @@
/*
* utils.c: miscellaneous utilities
*
- * Copyright (c) 2013 - 2020, Přemysl Eric Janouch <p@janouch.name>
+ * Copyright (c) 2013 - 2021, Přemysl Eric Janouch <p@janouch.name>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted.
@@ -25,7 +25,9 @@
#include <errno.h>
#include <stdarg.h>
+#ifndef WIN32
#include <pwd.h>
+#endif // ! WIN32
#include "config.h"
#include "utils.h"
@@ -161,6 +163,10 @@ try_expand_tilde (const gchar *filename)
if (!until_slash)
return g_build_filename (g_get_home_dir () ?: "", filename, NULL);
+#ifdef WIN32
+ // TODO: also ensure that path separators are handled sensibly around here
+ return NULL;
+#else // ! WIN32
long buf_len = sysconf (_SC_GETPW_R_SIZE_MAX);
if (buf_len < 0)
buf_len = 1024;
@@ -177,6 +183,7 @@ try_expand_tilde (const gchar *filename)
result = g_strdup_printf ("%s%s", pwd.pw_dir, filename + until_slash);
g_free (buf);
return result;
+#endif // ! WIN32
}
gchar *