Rework how resource files are installed

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2022-02-01 15:34:21 +00:00
parent 47ac677388
commit 29122b180b
No known key found for this signature in database
GPG key ID: CDBAA37ABC74FBA0
4 changed files with 25 additions and 21 deletions

View file

@ -838,34 +838,40 @@ else
PLUGIN_LIST = $(subst /plugin.json,,$(wildcard */plugin.json))
endif
RESOURCE_FILES = \
$(wildcard */presets) \
$(wildcard */res/*.svg) \
$(filter-out HetrickCV/res/illustrator - deprecated/MyModule.svg,$(wildcard */res/*/*.svg)) \
$(wildcard */res/*.ttf) $(wildcard */res/*/*.ttf)
PLUGIN_RESOURCES =
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.lv2/resources/%)
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.lv2/resources/PluginManifests/%.json)
PLUGIN_RESOURCES += $(RESOURCE_FILES:%=../bin/CardinalFX.lv2/resources/%)
ifeq ($(MACOS),true)
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.vst/Contents/Resources/%)
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.vst/Contents/Resources/PluginManifests/%.json)
PLUGIN_RESOURCES += $(RESOURCE_FILES:%=../bin/CardinalFX.vst/Contents/Resources/%)
else
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.vst/resources/%)
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.vst/resources/PluginManifests/%.json)
PLUGIN_RESOURCES += $(RESOURCE_FILES:%=../bin/CardinalFX.vst/resources/%)
endif
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.vst3/Contents/Resources/%)
PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.vst3/Contents/Resources/PluginManifests/%.json)
PLUGIN_RESOURCES += $(RESOURCE_FILES:%=../bin/CardinalFX.vst3/Contents/Resources/%)
resources: $(PLUGIN_RESOURCES)
../bin/CardinalFX.lv2/resources/%: %/res
../bin/CardinalFX.lv2/resources/%: %
-@mkdir -p "$(shell dirname $@)"
ln -sf $(abspath $<) $@
../bin/CardinalFX.vst/resources/%: %/res
../bin/CardinalFX.vst/resources/%: %
-@mkdir -p "$(shell dirname $@)"
ln -sf $(abspath $<) $@
../bin/CardinalFX.vst/Contents/Resources/%: %/res
../bin/CardinalFX.vst/Contents/Resources/%: %
-@mkdir -p "$(shell dirname $@)"
ln -sf $(abspath $<) $@
../bin/CardinalFX.vst3/Contents/Resources/%: %/res
../bin/CardinalFX.vst3/Contents/Resources/%: %
-@mkdir -p "$(shell dirname $@)"
ln -sf $(abspath $<) $@

@ -1 +1 @@
Subproject commit c1b128866786246a407c10713efb00ecc8486ced
Subproject commit 01c4fac9f2e91f60125d36767224f457b2057fb7

View file

@ -223,7 +223,7 @@ ifeq ($(NAME),CardinalFX)
all: lv2 vst2 vst3 resources
CORE_RESOURCES = $(filter-out icon.png,$(subst ../Rack/res/,,$(wildcard ../Rack/res/*))) template.vcv
CORE_RESOURCES = $(subst ../Rack/res/,,$(wildcard ../Rack/res/ComponentLibrary/*.svg ../Rack/res/fonts/*.ttf)) template.vcv
PLUGIN_RESOURCES += $(CORE_RESOURCES:%=$(TARGET_DIR)/CardinalFX.lv2/resources/%)
ifeq ($(MACOS),true)

View file

@ -50,14 +50,16 @@ std::string user(std::string filename) {
// get system resource, trimming "res/" prefix if we are loaded as a plugin bundle
std::string system(std::string filename) {
if (string::endsWith(filename, "/ComponentLibrary/ScrewSilver.svg"))
// Always use dark screws
if (string::endsWith(filename, "/ScrewSilver.svg"))
filename = filename.substr(0, filename.size()-10) + "Black.svg";
return system::join(systemDir, bundlePath.empty() ? filename : trim(filename));
}
// get plugin resource, also trims "res/" as needed
// get plugin resource
std::string plugin(plugin::Plugin* plugin, std::string filename) {
DISTRHO_SAFE_ASSERT_RETURN(plugin != nullptr, {});
// always use dark scheme
if (plugin->slug == "GlueTheGiant")
{
if (filename == "res/BusDepot.svg"
@ -73,28 +75,24 @@ std::string plugin(plugin::Plugin* plugin, std::string filename) {
filename = filename.substr(0, filename.size()-4) + "_Night.svg";
}
}
return system::join(plugin->path, trim(filename));
return system::join(plugin->path, filename);
}
// path to plugin manifest
std::string pluginManifest(const std::string& dirname) {
// no bundlePath set, assume local source build
if (bundlePath.empty())
{
if (dirname == "Core")
return system::join(systemDir, "..", "..", "plugins", "Core.json");
return system::join(systemDir, "..", "..", "plugins", dirname, "plugin.json");
}
// bundlePath is present, use resources from bundle
return system::join(bundlePath, dirname + ".json");
}
// path to plugin files
std::string pluginPath(const std::string& dirname) {
// no bundlePath set, assume local source build
if (bundlePath.empty())
{
if (dirname == "Core")
return systemDir;
return system::join(systemDir, "..", "..", "plugins", "res", dirname);
}
// bundlePath is present, use resources from bundle
return system::join(systemDir, dirname);
}