diff options
author | David Robillard <d@drobilla.net> | 2022-11-12 17:54:18 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-11-16 10:22:55 -0500 |
commit | 82ead5a276a9264a90a12afd120dc0bfaecba4b7 (patch) | |
tree | fb75def8f83467917b51c48eaca5a827b0af3434 /src | |
parent | 9374e4f1cafd8e48fbdcb455dc6fbdd958a52b67 (diff) | |
download | lilv-82ead5a276a9264a90a12afd120dc0bfaecba4b7.tar.gz lilv-82ead5a276a9264a90a12afd120dc0bfaecba4b7.tar.bz2 lilv-82ead5a276a9264a90a12afd120dc0bfaecba4b7.zip |
Use zix_temp_directory_path()
Diffstat (limited to 'src')
-rw-r--r-- | src/filesystem.c | 22 | ||||
-rw-r--r-- | src/filesystem.h | 4 |
2 files changed, 2 insertions, 24 deletions
diff --git a/src/filesystem.c b/src/filesystem.c index 6958600..ec13df3 100644 --- a/src/filesystem.c +++ b/src/filesystem.c @@ -5,6 +5,7 @@ #include "lilv_config.h" #include "lilv_internal.h" +#include "zix/filesystem.h" #include "zix/path.h" #ifdef _WIN32 @@ -49,25 +50,6 @@ is_windows_path(const char* path) } #endif -char* -lilv_temp_directory_path(void) -{ -#ifdef _WIN32 - DWORD len = GetTempPath(0, NULL); - char* buf = (char*)calloc(len, 1); - if (GetTempPath(len, buf) == 0) { - free(buf); - return NULL; - } - - return buf; -#else - const char* const tmpdir = getenv("TMPDIR"); - - return tmpdir ? lilv_strdup(tmpdir) : lilv_strdup("/tmp"); -#endif -} - bool lilv_path_is_absolute(const char* path) { @@ -367,7 +349,7 @@ lilv_create_temporary_directory_in(const char* pattern, const char* parent) char* lilv_create_temporary_directory(const char* pattern) { - char* const tmpdir = lilv_temp_directory_path(); + char* const tmpdir = zix_temp_directory_path(NULL); char* const result = lilv_create_temporary_directory_in(pattern, tmpdir); free(tmpdir); diff --git a/src/filesystem.h b/src/filesystem.h index 9337a97..a1b8fd7 100644 --- a/src/filesystem.h +++ b/src/filesystem.h @@ -4,10 +4,6 @@ #include <stdbool.h> #include <stdio.h> -/// Return the path to a directory suitable for making temporary files -char* -lilv_temp_directory_path(void); - /// Return true iff `path` is an absolute path bool lilv_path_is_absolute(const char* path); |