You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.5KB

  1. #pragma once
  2. #include <common.hpp>
  3. namespace rack {
  4. namespace plugin {
  5. struct Plugin;
  6. } // namespace plugin
  7. namespace engine {
  8. struct Module;
  9. } // namespace engine
  10. namespace asset {
  11. void init();
  12. /** Returns the path of a system asset. Should only read files from this location. */
  13. std::string system(std::string filename = "");
  14. /** Returns the path of a user asset. Can read and write files to this location. */
  15. std::string user(std::string filename = "");
  16. /** Returns the path of a asset in the plugin's folder.
  17. Plugin assets should be read-only by plugins.
  18. Examples:
  19. asset::plugin(pluginInstance, "samples/00.wav") // "/path/to/Rack/user/folder/plugins/MyPlugin/samples/00.wav"
  20. */
  21. std::string plugin(plugin::Plugin* plugin, std::string filename = "");
  22. /** Returns the path to an asset in the module patch folder.
  23. The module patch folder is *not* created automatically. Before creating files at these paths, call
  24. system::createDirectories(asset::module(module))
  25. Examples:
  26. asset::module(module, "recordings/00.wav") // "/path/to/Rack/user/folder/autosave/modules/1234/recordings/00.wav"
  27. */
  28. std::string module(engine::Module* module, const std::string& filename = "");
  29. // Set these before calling init() to override the default paths
  30. extern std::string systemDir;
  31. extern std::string userDir;
  32. extern std::string logPath;
  33. extern std::string pluginsPath;
  34. extern std::string settingsPath;
  35. extern std::string autosavePath;
  36. extern std::string templatePath;
  37. // Only defined on Mac
  38. extern std::string bundlePath;
  39. } // namespace asset
  40. } // namespace rack