summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorStef Walter <stefw@gnome.org>2013-04-06 16:41:08 +0200
committerStef Walter <stefw@gnome.org>2013-05-21 11:27:32 +0200
commit7b848defc704cc1fbb47a16b23727583c14b804d (patch)
tree4476037ffe6efc6b6f05fbc446e2ca80547e9df2 /common
parent10d26767fa39f43b0aabb82d73ed88b2c2522397 (diff)
downloadp11-kit-7b848defc704cc1fbb47a16b23727583c14b804d.tar.gz
Support /xxx/yyy as an absolute path with Win32
Because win32 code doesn't just run on windows, wine runs with unix style paths.
Diffstat (limited to 'common')
-rw-r--r--common/path.c8
-rw-r--r--common/tests/test-path.c2
2 files changed, 5 insertions, 5 deletions
diff --git a/common/path.c b/common/path.c
index bba2c23..3f1fccc 100644
--- a/common/path.c
+++ b/common/path.c
@@ -201,11 +201,11 @@ p11_path_absolute (const char *path)
{
return_val_if_fail (path != NULL, false);
-#ifdef OS_UNIX
- return (path[0] == '/');
-#else
- return (path[0] != '\0' && path[1] == ':' && path[2] == '\\');
+ return (path[0] == '/')
+#ifdef OS_WIN32
+ || (path[0] != '\0' && path[1] == ':' && path[2] == '\\')
#endif
+ ;
}
char *
diff --git a/common/tests/test-path.c b/common/tests/test-path.c
index 8263d1f..def4199 100644
--- a/common/tests/test-path.c
+++ b/common/tests/test-path.c
@@ -174,7 +174,7 @@ test_absolute (CuTest *tc)
#else /* OS_WIN32 */
CuAssertTrue (tc, p11_path_absolute ("C:\\home"));
CuAssertTrue (tc, !p11_path_absolute ("home"));
- CuAssertTrue (tc, !p11_path_absolute ("/home"));
+ CuAssertTrue (tc, p11_path_absolute ("/home"));
#endif
}