diff options
author | David Robillard <d@drobilla.net> | 2022-11-12 17:54:27 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-11-16 10:22:55 -0500 |
commit | 072e460e00cc0460a3385d73f266262956cd3014 (patch) | |
tree | c1d40c726fc5eed14c61b4547877ebdb9dbf1e4e | |
parent | 42439bc6e35eef7c3cc905c60b5924c200b49ec8 (diff) | |
download | lilv-072e460e00cc0460a3385d73f266262956cd3014.tar.gz lilv-072e460e00cc0460a3385d73f266262956cd3014.tar.bz2 lilv-072e460e00cc0460a3385d73f266262956cd3014.zip |
Use zix_path_is_absolute()
-rw-r--r-- | src/filesystem.c | 16 | ||||
-rw-r--r-- | src/filesystem.h | 4 | ||||
-rw-r--r-- | src/state.c | 4 | ||||
-rw-r--r-- | test/test_filesystem.c | 20 |
4 files changed, 2 insertions, 42 deletions
diff --git a/src/filesystem.c b/src/filesystem.c index b17f67a..e2fc776 100644 --- a/src/filesystem.c +++ b/src/filesystem.c @@ -42,22 +42,6 @@ is_windows_path(const char* path) #endif bool -lilv_path_is_absolute(const char* path) -{ - if (lilv_is_dir_sep(path[0])) { - return true; - } - -#ifdef _WIN32 - if (is_windows_path(path)) { - return true; - } -#endif - - return false; -} - -bool lilv_path_is_child(const char* path, const char* dir) { if (path && dir) { diff --git a/src/filesystem.h b/src/filesystem.h index e50b1af..849d78f 100644 --- a/src/filesystem.h +++ b/src/filesystem.h @@ -3,10 +3,6 @@ #include <stdbool.h> -/// Return true iff `path` is an absolute path -bool -lilv_path_is_absolute(const char* path); - /// Return true iff `path` is a child of `dir` bool lilv_path_is_child(const char* path, const char* dir); diff --git a/src/state.c b/src/state.c index 7ee8f87..ba2df78 100644 --- a/src/state.c +++ b/src/state.c @@ -340,7 +340,7 @@ absolute_path(LV2_State_Map_Path_Handle handle, const char* state_path) { LilvState* state = (LilvState*)handle; char* path = NULL; - if (lilv_path_is_absolute(state_path)) { + if (zix_path_is_absolute(state_path)) { // Absolute path, return identical path path = lilv_strdup(state_path); } else if (state->dir) { @@ -573,7 +573,7 @@ set_state_dir_from_model(LilvState* state, const SordNode* graph) state->dir = zix_path_join(NULL, path, NULL); free(path); } - assert(!state->dir || lilv_path_is_absolute(state->dir)); + assert(!state->dir || zix_path_is_absolute(state->dir)); } static LilvState* diff --git a/test/test_filesystem.c b/test/test_filesystem.c index 75db963..1453892 100644 --- a/test/test_filesystem.c +++ b/test/test_filesystem.c @@ -25,25 +25,6 @@ equals(char* string, const char* expected) } static void -test_path_is_absolute(void) -{ - assert(lilv_path_is_absolute("/a/b")); - assert(lilv_path_is_absolute("/a")); - assert(lilv_path_is_absolute("/")); - - assert(!lilv_path_is_absolute("a/b")); - assert(!lilv_path_is_absolute("a")); - assert(!lilv_path_is_absolute(".")); - -#ifdef _WIN32 - assert(lilv_path_is_absolute("C:/a/b")); - assert(lilv_path_is_absolute("C:\\a\\b")); - assert(lilv_path_is_absolute("D:/a/b")); - assert(lilv_path_is_absolute("D:\\a\\b")); -#endif -} - -static void test_path_is_child(void) { assert(lilv_path_is_child("/a/b", "/a")); @@ -210,7 +191,6 @@ test_dir_for_each(void) int main(void) { - test_path_is_absolute(); test_path_is_child(); test_path_current(); test_path_relative_to(); |