summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-07-10 20:12:24 +0200
committerDavid Robillard <d@drobilla.net>2018-07-10 21:58:32 +0200
commitcfa27c5274499f9609a9d4c0c224f3d205aa7f4a (patch)
tree35b9cf6f128a607d905f93d5bf5313b142c0da4f /src
parent06ccf8c3eb72ef6aa1d7eca54434870cd35ef451 (diff)
downloadlilv-cfa27c5274499f9609a9d4c0c224f3d205aa7f4a.tar.gz
lilv-cfa27c5274499f9609a9d4c0c224f3d205aa7f4a.tar.bz2
lilv-cfa27c5274499f9609a9d4c0c224f3d205aa7f4a.zip
Don't check for existence before attempting to create directories
Diffstat (limited to 'src')
-rw-r--r--src/state.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/state.c b/src/state.c
index 7fe52cc..2d1b349 100644
--- a/src/state.c
+++ b/src/state.c
@@ -207,9 +207,7 @@ static char*
make_path(LV2_State_Make_Path_Handle handle, const char* path)
{
LilvState* state = (LilvState*)handle;
- if (!lilv_path_exists(state->dir, NULL)) {
- lilv_mkdir_p(state->dir);
- }
+ lilv_mkdir_p(state->dir);
return lilv_path_join(state->dir, path);
}
@@ -238,17 +236,19 @@ abstract_path(LV2_State_Map_Path_Handle handle,
// File created by plugin earlier
path = lilv_path_relative_to(real_path, state->file_dir);
if (state->copy_dir) {
- if (!lilv_path_exists(state->copy_dir, NULL)) {
- lilv_mkdir_p(state->copy_dir);
+ int st = lilv_mkdir_p(state->copy_dir);
+ if (st) {
+ LILV_ERRORF("Error creating directory %s (%s)\n",
+ state->copy_dir, strerror(st));
}
+
char* cpath = lilv_path_join(state->copy_dir, path);
char* copy = lilv_get_latest_copy(real_path, cpath);
if (!copy || !lilv_file_equals(real_path, copy)) {
// No recent enough copy, make a new one
free(copy);
copy = lilv_find_free_path(cpath, lilv_path_exists, NULL);
- const int st = lilv_copy_file(real_path, copy);
- if (st) {
+ if ((st = lilv_copy_file(real_path, copy))) {
LILV_ERRORF("Error copying state file %s (%s)\n",
copy, strerror(st));
}