Browse Source

Fix LV2 state map/make path features

tags/1.9.5
falkTX 10 years ago
parent
commit
1a4b7aab1a
2 changed files with 38 additions and 6 deletions
  1. +19
    -3
      source/backend/plugin/Lv2Plugin.cpp
  2. +19
    -3
      source/bridges-ui/CarlaBridgeUI-LV2.cpp

+ 19
- 3
source/backend/plugin/Lv2Plugin.cpp View File

@@ -5463,8 +5463,16 @@ private:
CARLA_SAFE_ASSERT_RETURN(path != nullptr && path[0] != '\0', nullptr); CARLA_SAFE_ASSERT_RETURN(path != nullptr && path[0] != '\0', nullptr);
carla_debug("carla_lv2_state_make_path(%p, \"%s\")", handle, path); carla_debug("carla_lv2_state_make_path(%p, \"%s\")", handle, path);


File(path).createDirectory();
return strdup(path);
File file;

if (File::isAbsolutePath(path))
file = File(path);
else
file = File::getCurrentWorkingDirectory().getChildFile(path);

file.getParentDirectory().createDirectory();

return strdup(file.getFullPathName().toRawUTF8());
} }


static char* carla_lv2_state_map_abstract_path(LV2_State_Map_Path_Handle handle, const char* absolute_path) static char* carla_lv2_state_map_abstract_path(LV2_State_Map_Path_Handle handle, const char* absolute_path)
@@ -5473,6 +5481,10 @@ private:
CARLA_SAFE_ASSERT_RETURN(absolute_path != nullptr && absolute_path[0] != '\0', nullptr); CARLA_SAFE_ASSERT_RETURN(absolute_path != nullptr && absolute_path[0] != '\0', nullptr);
carla_debug("carla_lv2_state_map_abstract_path(%p, \"%s\")", handle, absolute_path); carla_debug("carla_lv2_state_map_abstract_path(%p, \"%s\")", handle, absolute_path);


// may already be an abstract path
if (! File::isAbsolutePath(absolute_path))
return strdup(absolute_path);

return strdup(File(absolute_path).getRelativePathFrom(File::getCurrentWorkingDirectory()).toRawUTF8()); return strdup(File(absolute_path).getRelativePathFrom(File::getCurrentWorkingDirectory()).toRawUTF8());
} }


@@ -5482,7 +5494,11 @@ private:
CARLA_SAFE_ASSERT_RETURN(abstract_path != nullptr && abstract_path[0] != '\0', nullptr); CARLA_SAFE_ASSERT_RETURN(abstract_path != nullptr && abstract_path[0] != '\0', nullptr);
carla_debug("carla_lv2_state_map_absolute_path(%p, \"%s\")", handle, abstract_path); carla_debug("carla_lv2_state_map_absolute_path(%p, \"%s\")", handle, abstract_path);


return strdup(File(abstract_path).getFullPathName().toRawUTF8());
// may already be an absolute path
if (File::isAbsolutePath(abstract_path))
return strdup(abstract_path);

return strdup(File::getCurrentWorkingDirectory().getChildFile(abstract_path).getFullPathName().toRawUTF8());
} }


static LV2_State_Status carla_lv2_state_store(LV2_State_Handle handle, uint32_t key, const void* value, size_t size, uint32_t type, uint32_t flags) static LV2_State_Status carla_lv2_state_store(LV2_State_Handle handle, uint32_t key, const void* value, size_t size, uint32_t type, uint32_t flags)


+ 19
- 3
source/bridges-ui/CarlaBridgeUI-LV2.cpp View File

@@ -855,8 +855,16 @@ private:
CARLA_SAFE_ASSERT_RETURN(path != nullptr && path[0] != '\0', nullptr); CARLA_SAFE_ASSERT_RETURN(path != nullptr && path[0] != '\0', nullptr);
carla_debug("carla_lv2_state_make_path(%p, \"%s\")", handle, path); carla_debug("carla_lv2_state_make_path(%p, \"%s\")", handle, path);


File(path).createDirectory();
return strdup(path);
File file;

if (File::isAbsolutePath(path))
file = File(path);
else
file = File::getCurrentWorkingDirectory().getChildFile(path);

file.getParentDirectory().createDirectory();

return strdup(file.getFullPathName().toRawUTF8());
} }


static char* carla_lv2_state_map_abstract_path(LV2_State_Map_Path_Handle handle, const char* absolute_path) static char* carla_lv2_state_map_abstract_path(LV2_State_Map_Path_Handle handle, const char* absolute_path)
@@ -865,6 +873,10 @@ private:
CARLA_SAFE_ASSERT_RETURN(absolute_path != nullptr && absolute_path[0] != '\0', nullptr); CARLA_SAFE_ASSERT_RETURN(absolute_path != nullptr && absolute_path[0] != '\0', nullptr);
carla_debug("carla_lv2_state_map_abstract_path(%p, \"%s\")", handle, absolute_path); carla_debug("carla_lv2_state_map_abstract_path(%p, \"%s\")", handle, absolute_path);


// may already be an abstract path
if (! File::isAbsolutePath(absolute_path))
return strdup(absolute_path);

return strdup(File(absolute_path).getRelativePathFrom(File::getCurrentWorkingDirectory()).toRawUTF8()); return strdup(File(absolute_path).getRelativePathFrom(File::getCurrentWorkingDirectory()).toRawUTF8());
} }


@@ -874,7 +886,11 @@ private:
CARLA_SAFE_ASSERT_RETURN(abstract_path != nullptr && abstract_path[0] != '\0', nullptr); CARLA_SAFE_ASSERT_RETURN(abstract_path != nullptr && abstract_path[0] != '\0', nullptr);
carla_debug("carla_lv2_state_map_absolute_path(%p, \"%s\")", handle, abstract_path); carla_debug("carla_lv2_state_map_absolute_path(%p, \"%s\")", handle, abstract_path);


return strdup(File(abstract_path).getFullPathName().toRawUTF8());
// may already be an absolute path
if (File::isAbsolutePath(abstract_path))
return strdup(abstract_path);

return strdup(File::getCurrentWorkingDirectory().getChildFile(abstract_path).getFullPathName().toRawUTF8());
} }


// ------------------------------------------------------------------- // -------------------------------------------------------------------


Loading…
Cancel
Save