Browse Source

Add RACK_SYSTEM_DIR and RACK_USER_DIR environment variables on all OS's to override asset paths.

tags/v2.0.0
Andrew Belt 2 years ago
parent
commit
6cfccfcb55
1 changed files with 14 additions and 0 deletions
  1. +14
    -0
      src/asset.cpp

+ 14
- 0
src/asset.cpp View File

@@ -38,6 +38,13 @@ static void initSystemDir() {
return; return;
} }


// Environment variable overrides
const char* env = getenv("RACK_SYSTEM_DIR");
if (env) {
systemDir = env;
return;
}

#if defined ARCH_MAC #if defined ARCH_MAC
CFBundleRef bundle = CFBundleGetMainBundle(); CFBundleRef bundle = CFBundleGetMainBundle();
assert(bundle); assert(bundle);
@@ -85,6 +92,13 @@ static void initUserDir() {
return; return;
} }


// Environment variable overrides
const char* env = getenv("RACK_USER_DIR");
if (env) {
userDir = env;
return;
}

#if defined ARCH_WIN #if defined ARCH_WIN
// Get "My Documents" path // Get "My Documents" path
wchar_t documentsBufW[MAX_PATH] = L"."; wchar_t documentsBufW[MAX_PATH] = L".";


Loading…
Cancel
Save