diff options
Diffstat (limited to 'src/filesystem.c')
-rw-r--r-- | src/filesystem.c | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/src/filesystem.c b/src/filesystem.c index a690338..945751f 100644 --- a/src/filesystem.c +++ b/src/filesystem.c @@ -2,8 +2,6 @@ // SPDX-License-Identifier: ISC #include "filesystem.h" -#include "lilv_config.h" -#include "lilv_internal.h" #include "zix/allocator.h" #include "zix/filesystem.h" @@ -11,24 +9,8 @@ #include <stdbool.h> #include <stdio.h> -#include <stdlib.h> #include <string.h> -static bool -lilv_is_dir_sep(const char c) -{ - return c == '/' || c == LILV_DIR_SEP[0]; -} - -#ifdef _WIN32 -static inline bool -is_windows_path(const char* path) -{ - return (isalpha(path[0]) && (path[1] == ':' || path[1] == '|') && - (path[2] == '/' || path[2] == '\\')); -} -#endif - bool lilv_path_is_child(const char* path, const char* dir) { @@ -41,34 +23,6 @@ lilv_path_is_child(const char* path, const char* dir) } char* -lilv_path_parent(const char* path) -{ - const char* s = path + strlen(path) - 1; // Last character - - // Last non-slash - for (; s > path && lilv_is_dir_sep(*s); --s) { - } - - // Last internal slash - for (; s > path && !lilv_is_dir_sep(*s); --s) { - } - - // Skip duplicates - for (; s > path && lilv_is_dir_sep(*s); --s) { - } - - if (s == path) { // Hit beginning - return lilv_is_dir_sep(*s) ? lilv_strdup("/") : lilv_strdup("."); - } - - // Pointing to the last character of the result (inclusive) - char* dirname = (char*)malloc(s - path + 2); - memcpy(dirname, path, s - path + 1); - dirname[s - path + 1] = '\0'; - return dirname; -} - -char* lilv_create_temporary_directory(const char* pattern) { char* const tmpdir = zix_temp_directory_path(NULL); |