Signed-off-by: falkTX <falktx@gmail.com>tags/v2.1-alpha1-winvst
| @@ -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_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); | 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; | uint id; | ||||
| #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | ||||
| @@ -314,6 +314,11 @@ int main(int argc, char* argv[]) | |||||
| return 1; | return 1; | ||||
| } | } | ||||
| // --------------------------------------------------------------------- | |||||
| // Set file | |||||
| const File file(filename != nullptr ? filename : ""); | |||||
| // --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
| // Set name | // Set name | ||||
| @@ -424,8 +429,7 @@ int main(int argc, char* argv[]) | |||||
| } | } | ||||
| else | 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 | // 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 | // 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; | ret = 0; | ||||
| @@ -217,15 +217,6 @@ String File::parseAbsolutePath (const String& p) | |||||
| } | } | ||||
| else if (! path.startsWithChar (separator)) | 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(); | return File::getCurrentWorkingDirectory().getChildFile (path).getFullPathName(); | ||||
| } | } | ||||
| #endif | #endif | ||||