Browse Source

Set Core plugin path to the system dir instead of leaving blank.

tags/v2.0.0
Andrew Belt 4 years ago
parent
commit
d7da2e2b93
2 changed files with 12 additions and 8 deletions
  1. +8
    -4
      src/asset.cpp
  2. +4
    -4
      src/plugin.cpp

+ 8
- 4
src/asset.cpp View File

@@ -33,7 +33,9 @@ static void initSystemDir() {
return; return;


if (settings::devMode) { if (settings::devMode) {
systemDir = ".";
char buf[4096] = ".";
getcwd(buf, sizeof(buf));
systemDir = buf;
return; return;
} }


@@ -69,8 +71,10 @@ static void initSystemDir() {
systemDir = string::fromWstring(moduleBufW); systemDir = string::fromWstring(moduleBufW);
#endif #endif
#if defined ARCH_LIN #if defined ARCH_LIN
// Users should launch Rack from their terminal in the system directory
systemDir = ".";
// Use the current working directory as the default path on Linux.
char buf[4096] = ".";
getcwd(buf, sizeof(buf));
systemDir = buf;
#endif #endif
} }


@@ -80,7 +84,7 @@ static void initUserDir() {
return; return;


if (settings::devMode) { if (settings::devMode) {
userDir = ".";
userDir = systemDir;
return; return;
} }




+ 4
- 4
src/plugin.cpp View File

@@ -55,8 +55,7 @@ static void* loadLibrary(std::string libraryPath) {
} }
#else #else
// Plugin uses -rpath=. so change working directory so it can find libRack. // Plugin uses -rpath=. so change working directory so it can find libRack.
char cwd[PATH_MAX];
cwd[0] = '\0';
char cwd[PATH_MAX] = "";
getcwd(cwd, sizeof(cwd)); getcwd(cwd, sizeof(cwd));
chdir(asset::systemDir.c_str()); chdir(asset::systemDir.c_str());
// And then change it back // And then change it back
@@ -113,7 +112,8 @@ static InitCallback loadPluginCallback(Plugin* plugin) {
static Plugin* loadPlugin(std::string path) { static Plugin* loadPlugin(std::string path) {
Plugin* plugin = new Plugin; Plugin* plugin = new Plugin;
try { try {
plugin->path = path;
// Set plugin path
plugin->path = (path == "") ? asset::systemDir : path;


// Get modified timestamp // Get modified timestamp
if (path != "") { if (path != "") {
@@ -167,7 +167,7 @@ static Plugin* loadPlugin(std::string path) {
throw Exception(string::f("Plugin %s is already loaded, not attempting to load it again", plugin->slug.c_str())); throw Exception(string::f("Plugin %s is already loaded, not attempting to load it again", plugin->slug.c_str()));
} }


INFO("Loaded plugin %s v%s from %s", plugin->slug.c_str(), plugin->version.c_str(), path.c_str());
INFO("Loaded plugin %s v%s from %s", plugin->slug.c_str(), plugin->version.c_str(), plugin->path.c_str());
plugins.push_back(plugin); plugins.push_back(plugin);
} }
catch (Exception& e) { catch (Exception& e) {


Loading…
Cancel
Save