From 18c8af55e63653c74d58137cd12434f1213f4230 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 4 Aug 2020 16:07:48 +0200 Subject: Rename some filename utilities for clarity Loosely inspired by Python and the std::filesystem API. --- test/lilv_test_utils.c | 6 +++--- test/test_state.c | 6 +++--- test/test_string.c | 16 ++++++++-------- test/test_util.c | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) (limited to 'test') diff --git a/test/lilv_test_utils.c b/test/lilv_test_utils.c index 8c617b0..def3eca 100644 --- a/test/lilv_test_utils.c +++ b/test/lilv_test_utils.c @@ -53,7 +53,7 @@ lilv_test_env_new(void) env->plugin2_uri = lilv_new_uri(world, "http://example.org/foobar"); // Set custom LV2_PATH in build directory to only use test data - char* test_path = lilv_realpath(LILV_TEST_DIR); + char* test_path = lilv_path_canonical(LILV_TEST_DIR); char* lv2_path = lilv_strjoin(test_path, "/test_lv2_path", NULL); LilvNode* path = lilv_new_string(world, lv2_path); lilv_world_set_option(world, LILV_OPTION_LV2_PATH, path); @@ -83,12 +83,12 @@ create_bundle(LilvTestEnv* env, const char* manifest, const char* plugin) { static const char* const bundle_path = "/test_lv2_path/lilv-test.lv2"; - char* const test_path = lilv_realpath(LILV_TEST_DIR); + char* const test_path = lilv_path_canonical(LILV_TEST_DIR); env->test_bundle_path = lilv_strjoin(test_path, bundle_path, NULL); lilv_free(test_path); } - if (lilv_mkdir_p(env->test_bundle_path)) { + if (lilv_create_directories(env->test_bundle_path)) { fprintf(stderr, "Failed to create directory '%s' (%s)\n", env->test_bundle_path, diff --git a/test/test_state.c b/test/test_state.c index 178732f..acca4e9 100644 --- a/test/test_state.c +++ b/test/test_state.c @@ -175,7 +175,7 @@ main(void) assert(in == 1.0); assert(out == 1.0); - temp_dir = lilv_realpath("temp"); + temp_dir = lilv_path_canonical("temp"); const char* scratch_dir = NULL; char* copy_dir = NULL; @@ -369,9 +369,9 @@ main(void) mkdir("temp", 0700); scratch_dir = temp_dir; mkdir("files", 0700); - copy_dir = lilv_realpath("files"); + copy_dir = lilv_path_canonical("files"); mkdir("links", 0700); - link_dir = lilv_realpath("links"); + link_dir = lilv_path_canonical("links"); LV2_State_Make_Path make_path = {NULL, lilv_make_path}; LV2_Feature make_path_feature = {LV2_STATE__makePath, &make_path}; diff --git a/test/test_string.c b/test/test_string.c index 0bad915..d782c08 100644 --- a/test/test_string.c +++ b/test/test_string.c @@ -36,21 +36,21 @@ main(void) { char* s = NULL; - assert(!strcmp((s = lilv_dirname("/foo/bar")), "/foo")); + assert(!strcmp((s = lilv_path_parent("/foo/bar")), "/foo")); free(s); - assert(!strcmp((s = lilv_dirname("/foo/bar/")), "/foo")); + assert(!strcmp((s = lilv_path_parent("/foo/bar/")), "/foo")); free(s); - assert(!strcmp((s = lilv_dirname("/foo///bar/")), "/foo")); + assert(!strcmp((s = lilv_path_parent("/foo///bar/")), "/foo")); free(s); - assert(!strcmp((s = lilv_dirname("/foo///bar//")), "/foo")); + assert(!strcmp((s = lilv_path_parent("/foo///bar//")), "/foo")); free(s); - assert(!strcmp((s = lilv_dirname("foo")), ".")); + assert(!strcmp((s = lilv_path_parent("foo")), ".")); free(s); - assert(!strcmp((s = lilv_dirname("/foo")), "/")); + assert(!strcmp((s = lilv_path_parent("/foo")), "/")); free(s); - assert(!strcmp((s = lilv_dirname("/")), "/")); + assert(!strcmp((s = lilv_path_parent("/")), "/")); free(s); - assert(!strcmp((s = lilv_dirname("//")), "/")); + assert(!strcmp((s = lilv_path_parent("//")), "/")); free(s); assert(!strcmp((s = lilv_path_relative_to("/a/b", "/a/")), "b")); free(s); diff --git a/test/test_util.c b/test/test_util.c index fb41ca4..9055e88 100644 --- a/test/test_util.c +++ b/test/test_util.c @@ -37,7 +37,7 @@ int main(void) { - assert(!lilv_realpath(NULL)); + assert(!lilv_path_canonical(NULL)); char a_path[16]; char b_path[16]; -- cgit v1.2.1