summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-08-18 09:52:47 +0200
committerDavid Robillard <d@drobilla.net>2018-08-18 09:52:47 +0200
commite0582935e737dccc0528f113b35296f39f360b06 (patch)
tree62bcef2ee4286fc91e5488267aecb5819b468401
parent4b298e4c7fa74836d023726185dfb2325d675c51 (diff)
downloadlilv-fix-windows-mkdir.tar.gz
lilv-fix-windows-mkdir.tar.bz2
lilv-fix-windows-mkdir.zip
Fix creating directories across drives on Windowsfix-windows-mkdir
-rw-r--r--NEWS6
-rw-r--r--src/util.c19
-rw-r--r--wscript2
3 files changed, 24 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index e545386..31421f5 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,9 @@
+lilv (0.24.5) unstable;
+
+ * Fix creating directories across drives on Windows
+
+ -- David Robillard <d@drobilla.net> Sat, 18 Aug 2018 09:52:17 +0200
+
lilv (0.24.4) stable;
* Fix saving state when broken links are encountered
diff --git a/src/util.c b/src/util.c
index 4973181..98e89d8 100644
--- a/src/util.c
+++ b/src/util.c
@@ -333,6 +333,13 @@ lilv_copy_file(const char* src, const char* dst)
return st;
}
+static inline bool
+is_windows_path(const char* path)
+{
+ return (isalpha(path[0]) && (path[1] == ':' || path[1] == '|') &&
+ (path[2] == '/' || path[2] == '\\'));
+}
+
bool
lilv_path_is_absolute(const char* path)
{
@@ -341,7 +348,7 @@ lilv_path_is_absolute(const char* path)
}
#ifdef _WIN32
- if (isalpha(path[0]) && path[1] == ':' && lilv_is_dir_sep(path[2])) {
+ if (is_windows_path(path)) {
return true;
}
#endif
@@ -572,7 +579,15 @@ lilv_mkdir_p(const char* dir_path)
{
char* path = lilv_strdup(dir_path);
const size_t path_len = strlen(path);
- for (size_t i = 1; i <= path_len; ++i) {
+ size_t i = 1;
+
+#ifdef _WIN32
+ if (is_windows_path(dir_path)) {
+ i = 3;
+ }
+#endif
+
+ for (; i <= path_len; ++i) {
if (path[i] == LILV_DIR_SEP[0] || path[i] == '\0') {
path[i] = '\0';
if (mkdir(path, 0755) && errno != EEXIST) {
diff --git a/wscript b/wscript
index 9f31202..57ef231 100644
--- a/wscript
+++ b/wscript
@@ -12,7 +12,7 @@ import waflib.Logs as Logs
# major increment <=> incompatible changes
# minor increment <=> compatible changes (additions)
# micro increment <=> no interface changes
-LILV_VERSION = '0.24.4'
+LILV_VERSION = '0.24.5'
LILV_MAJOR_VERSION = '0'
# Mandatory waf variables