Allow usage of local user dir and config

I held on for as long as I could, but plugin host caching needs it

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2023-05-18 21:54:41 +02:00
parent 2823dcfe78
commit e7bb99c3ce
No known key found for this signature in database
GPG key ID: CDBAA37ABC74FBA0
13 changed files with 221 additions and 71 deletions

View file

@ -1,6 +1,6 @@
/*
* DISTRHO Cardinal Plugin
* Copyright (C) 2021 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2021-2023 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@ -36,10 +36,19 @@ extern bool forceBlackScrew;
extern bool forceSilverScrew;
#endif
std::string userDir; // ignored
std::string configDir; // points to writable config dir (might be equal to userDir)
std::string userDir; // points to common writable dir
std::string systemDir; // points to plugin resources dir (or installed/local Rack dir)
std::string bundlePath; // points to plugin manifests dir (or empty)
std::string config(std::string filename) {
return system::join(configDir, filename);
}
std::string user(std::string filename) {
return system::join(userDir, filename);
}
// get rid of "res/" prefix
static inline std::string& trim(std::string& s)
{
@ -48,11 +57,6 @@ static inline std::string& trim(std::string& s)
return s;
}
// ignored, returns the same as `system`
std::string user(std::string filename) {
return system(filename);
}
// get system resource, trimming "res/" prefix if we are loaded as a plugin bundle
std::string system(std::string filename) {
#ifndef HEADLESS