summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/filesystem.c10
-rw-r--r--src/filesystem.h6
-rw-r--r--src/state.c14
-rw-r--r--src/util.c2
4 files changed, 16 insertions, 16 deletions
diff --git a/src/filesystem.c b/src/filesystem.c
index dbb528f..45ece12 100644
--- a/src/filesystem.c
+++ b/src/filesystem.c
@@ -149,7 +149,7 @@ lilv_path_relative_to(const char* path, const char* base)
}
char*
-lilv_dirname(const char* path)
+lilv_path_parent(const char* path)
{
const char* s = path + strlen(path) - 1; // Last character
for (; s > path && lilv_is_dir_sep(*s); --s) {} // Last non-slash
@@ -207,7 +207,7 @@ lilv_dir_path(const char* path)
}
char*
-lilv_realpath(const char* path)
+lilv_path_canonical(const char* path)
{
if (!path) {
return NULL;
@@ -325,7 +325,7 @@ lilv_dir_for_each(const char* path,
}
int
-lilv_mkdir_p(const char* dir_path)
+lilv_create_directories(const char* dir_path)
{
char* path = lilv_strdup(dir_path);
const size_t path_len = strlen(path);
@@ -373,8 +373,8 @@ lilv_file_equals(const char* a_path, const char* b_path)
bool match = false;
FILE* a_file = NULL;
FILE* b_file = NULL;
- char* const a_real = lilv_realpath(a_path);
- char* const b_real = lilv_realpath(b_path);
+ char* const a_real = lilv_path_canonical(a_path);
+ char* const b_real = lilv_path_canonical(b_path);
if (!strcmp(a_real, b_real)) {
match = true; // Real paths match
} else if (lilv_file_size(a_path) != lilv_file_size(b_path)) {
diff --git a/src/filesystem.h b/src/filesystem.h
index de06214..eb00e60 100644
--- a/src/filesystem.h
+++ b/src/filesystem.h
@@ -50,7 +50,7 @@ lilv_path_relative_to(const char* path, const char* base);
Returns the root path if `path` is the root path.
*/
char*
-lilv_dirname(const char* path);
+lilv_path_parent(const char* path);
/// Join path `a` and path `b` with a single directory separator between them
char*
@@ -67,7 +67,7 @@ lilv_dir_path(const char* path);
directory separators.
*/
char*
-lilv_realpath(const char* path);
+lilv_path_canonical(const char* path);
/// Return true iff `path` points to an existing file system entry
bool
@@ -122,7 +122,7 @@ lilv_dir_for_each(const char* path,
@return Zero on success, or an `errno` error code.
*/
int
-lilv_mkdir_p(const char* dir_path);
+lilv_create_directories(const char* dir_path);
/// Return true iff the given paths point to files with identical contents
bool
diff --git a/src/state.c b/src/state.c
index 749316c..85e8d0f 100644
--- a/src/state.c
+++ b/src/state.c
@@ -244,7 +244,7 @@ static char*
make_path(LV2_State_Make_Path_Handle handle, const char* path)
{
LilvState* state = (LilvState*)handle;
- lilv_mkdir_p(state->dir);
+ lilv_create_directories(state->dir);
return lilv_path_join(state->dir, path);
}
@@ -255,7 +255,7 @@ abstract_path(LV2_State_Map_Path_Handle handle,
{
LilvState* state = (LilvState*)handle;
char* path = NULL;
- char* real_path = lilv_realpath(abs_path);
+ char* real_path = lilv_path_canonical(abs_path);
const PathMap key = { real_path, NULL };
ZixTreeIter* iter = NULL;
@@ -273,7 +273,7 @@ abstract_path(LV2_State_Map_Path_Handle handle,
// File created by plugin earlier
path = lilv_path_relative_to(real_path, state->scratch_dir);
if (state->copy_dir) {
- int st = lilv_mkdir_p(state->copy_dir);
+ int st = lilv_create_directories(state->copy_dir);
if (st) {
LILV_ERRORF("Error creating directory %s (%s)\n",
state->copy_dir, strerror(st));
@@ -725,8 +725,8 @@ lilv_state_new_from_file(LilvWorld* world,
? subject->node
: sord_node_from_serd_node(world->world, env, &node, NULL, NULL);
- char* dirname = lilv_dirname(path);
- char* real_path = lilv_realpath(dirname);
+ char* dirname = lilv_path_parent(path);
+ char* real_path = lilv_path_canonical(dirname);
char* dir_path = lilv_dir_path(real_path);
LilvState* state =
new_state_from_model(world, map, model, subject_node, dir_path);
@@ -966,7 +966,7 @@ link_exists(const char* path, const void* data)
if (!lilv_path_exists(path)) {
return false;
}
- char* real_path = lilv_realpath(path);
+ char* real_path = lilv_path_canonical(path);
bool matches = !strcmp(real_path, target);
free(real_path);
return !matches;
@@ -1174,7 +1174,7 @@ lilv_state_save(LilvWorld* world,
const char* dir,
const char* filename)
{
- if (!filename || !dir || lilv_mkdir_p(dir)) {
+ if (!filename || !dir || lilv_create_directories(dir)) {
return 1;
}
diff --git a/src/util.c b/src/util.c
index 987d1ee..ac0ca55 100644
--- a/src/util.c
+++ b/src/util.c
@@ -264,7 +264,7 @@ update_latest(const char* path, const char* name, void* data)
char*
lilv_get_latest_copy(const char* path, const char* copy_path)
{
- char* copy_dir = lilv_dirname(copy_path);
+ char* copy_dir = lilv_path_parent(copy_path);
Latest latest = { lilv_strjoin(copy_path, ".%u", NULL), 0, NULL };
struct stat st;