Browse Source

Make water File paths accept paths from CWD, adjust bridges to it

Signed-off-by: falkTX <falktx@gmail.com>
tags/v2.1-alpha1-winvst
falkTX 6 years ago
parent
commit
3aa5352bb7
3 changed files with 11 additions and 12 deletions
  1. +4
    -0
      source/backend/engine/CarlaEngine.cpp
  2. +7
    -3
      source/bridges-plugin/CarlaBridgePlugin.cpp
  3. +0
    -9
      source/modules/water/files/File.cpp

+ 4
- 0
source/backend/engine/CarlaEngine.cpp View File

@@ -312,6 +312,10 @@ bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype,
CARLA_SAFE_ASSERT_RETURN_ERR((filename != nullptr && filename[0] != '\0') || (label != nullptr && label[0] != '\0'), "Invalid plugin filename and label");
carla_debug("CarlaEngine::addPlugin(%i:%s, %i:%s, \"%s\", \"%s\", \"%s\", " P_INT64 ", %p, %u)", btype, BinaryType2Str(btype), ptype, PluginType2Str(ptype), filename, name, label, uniqueId, extra, options);

if (filename != nullptr && filename[0] != '\0') {
CARLA_SAFE_ASSERT_RETURN_ERR(filename[0] == CARLA_OS_SEP || filename[0] == '.' || filename[0] == '~', "Invalid plugin filename");
}

uint id;

#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH


+ 7
- 3
source/bridges-plugin/CarlaBridgePlugin.cpp View File

@@ -314,6 +314,11 @@ int main(int argc, char* argv[])
return 1;
}

// ---------------------------------------------------------------------
// Set file

const File file(filename != nullptr ? filename : "");

// ---------------------------------------------------------------------
// Set name

@@ -424,8 +429,7 @@ int main(int argc, char* argv[])
}
else
{
const String jfilename = String(CharPointer_UTF8(filename));
clientName = File(jfilename).getFileNameWithoutExtension().toRawUTF8();
clientName = file.getFileNameWithoutExtension().toRawUTF8();
}

// if we still have no client name by now, use a dummy one
@@ -520,7 +524,7 @@ int main(int argc, char* argv[])
// -----------------------------------------------------------------
// Init plugin

if (carla_add_plugin(btype, itype, filename, name, label, uniqueId, extraStuff, 0x0))
if (carla_add_plugin(btype, itype, file.getFullPathName().toRawUTF8(), name, label, uniqueId, extraStuff, 0x0))
{
ret = 0;



+ 0
- 9
source/modules/water/files/File.cpp View File

@@ -217,15 +217,6 @@ String File::parseAbsolutePath (const String& p)
}
else if (! path.startsWithChar (separator))
{
/* When you supply a raw string to the File object constructor, it must be an absolute path.
If you're trying to parse a string that may be either a relative path or an absolute path,
you MUST provide a context against which the partial path can be evaluated - you can do
this by simply using File::getChildFile() instead of the File constructor. E.g. saying
"File::getCurrentWorkingDirectory().getChildFile (myUnknownPath)" would return an absolute
path if that's what was supplied, or would evaluate a partial path relative to the CWD.
*/
CARLA_SAFE_ASSERT_RETURN(path.startsWith ("./") || path.startsWith ("../"), String());
return File::getCurrentWorkingDirectory().getChildFile (path).getFullPathName();
}
#endif


Loading…
Cancel
Save