Browse Source

CLI: ensure custom directories exist

pull/1005/head
jfrey 7 years ago
parent
commit
d96663bd09
1 changed files with 16 additions and 2 deletions
  1. +16
    -2
      src/asset.cpp

+ 16
- 2
src/asset.cpp View File

@@ -19,6 +19,8 @@
#include <pwd.h> #include <pwd.h>
#endif #endif


#include <iostream>

namespace rack { namespace rack {




@@ -62,7 +64,13 @@ void assetInit(bool devMode, std::string customGlobalDir, std::string customLoca
#endif #endif
} }
else { else {
globalDir = customGlobalDir;
if (!systemIsDirectory(customGlobalDir)) {
std::cerr << "Selected global directory \"" << customGlobalDir << "\" does not exist or is not a directory, default to current directory." << std::endl;
globalDir = ".";
}
else {
globalDir = customGlobalDir;
}
} }


if (customLocalDir.empty()) { if (customLocalDir.empty()) {
@@ -94,7 +102,13 @@ void assetInit(bool devMode, std::string customGlobalDir, std::string customLoca
#endif #endif
} }
else { else {
localDir = customLocalDir;
if (!systemIsDirectory(customLocalDir)) {
std::cerr << "Selected local directory \"" << customLocalDir << "\" does not exist or is not a directory, default to current directory." << std::endl;
localDir = ".";
}
else {
localDir = customLocalDir;
}
} }
} }




Loading…
Cancel
Save