void World_LoadGraphDefs(World* world) { GraphDef *list = 0; if(getenv("SC_SYNTHDEF_PATH")){ if(world->mVerbosity > 0) printf("Loading synthdefs from path: %s\n", getenv("SC_SYNTHDEF_PATH")); SC_StringParser sp(getenv("SC_SYNTHDEF_PATH"), SC_STRPARSE_PATHDELIMITER); while (!sp.AtEnd()) { GraphDef *list = 0; char *path = const_cast<char *>(sp.NextToken()); list = GraphDef_LoadDir(world, path, list); GraphDef_Define(world, list); } }else{ char resourceDir[MAXPATHLEN]; if(sc_IsStandAlone()) sc_GetResourceDirectory(resourceDir, MAXPATHLEN); else sc_GetUserAppSupportDirectory(resourceDir, MAXPATHLEN); sc_AppendToPath(resourceDir, "synthdefs"); if(world->mVerbosity > 0) printf("Loading synthdefs from default path: %s\n", resourceDir); list = GraphDef_LoadDir(world, resourceDir, list); GraphDef_Define(world, list); } }
void SC_LanguageClient::initRuntime(const Options& opt) { // start virtual machine if (!mHiddenClient->mRunning) { #ifdef __linux__ char deprecatedSupportDirectory[PATH_MAX]; sc_GetUserHomeDirectory(deprecatedSupportDirectory, PATH_MAX); sc_AppendToPath(deprecatedSupportDirectory, PATH_MAX, "share/SuperCollider"); if (sc_DirectoryExists(deprecatedSupportDirectory)) { char supportDirectory[PATH_MAX]; sc_GetUserAppSupportDirectory(supportDirectory, PATH_MAX); postfl("WARNING: Deprecated support directory detected: %s\n" "Extensions and other contents in this directory will not be available until you move them to the new support directory:\n" "%s\n" "Quarks will need to be reinstalled due to broken symbolic links.\n\n", deprecatedSupportDirectory, supportDirectory); } #endif mHiddenClient->mRunning = true; if (opt.mRuntimeDir) { int err = chdir(opt.mRuntimeDir); if (err) error("Cannot change to runtime directory: %s", strerror(errno)); } pyr_init_mem_pools(opt.mMemSpace, opt.mMemGrow); init_OSC(opt.mPort); schedInit(); onInitRuntime(); } }
// Get the directory for the configuration files. void sc_GetUserConfigDirectory(char *str, int size) { // XDG support according to http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html const char * xdg_config_home = getenv("XDG_CONFIG_HOME"); if (xdg_config_home) { strncpy(str, xdg_config_home, size); sc_AppendToPath(str, size, "SuperCollider"); return; } #if defined(__linux__) || defined(__freebsd__) sc_GetUserHomeDirectory(str, size); sc_AppendToPath(str, size, ".config/SuperCollider"); #else sc_GetUserAppSupportDirectory(str, size); #endif }
void sc_GetUserExtensionDirectory(char *str, int size) { sc_GetUserAppSupportDirectory(str, size); sc_AppendToPath(str, size, "Extensions"); }
void sc_GetResourceDirectory(char* pathBuf, int length) { sc_GetUserAppSupportDirectory(pathBuf, length); }