Esempio n. 1
0
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);
	}

}
Esempio n. 2
0
GraphDef* GraphDef_LoadDir(World *inWorld, char *dirname, GraphDef *inList)
{
	SC_DirHandle *dir = sc_OpenDir(dirname);
	if (!dir) {
		scprintf("*** ERROR: open directory failed '%s'\n", dirname);
		return inList;
	}

	for (;;) {
		char diritem[MAXPATHLEN];
		bool skipItem = false;
		bool validItem = sc_ReadDir(dir, dirname, diritem, skipItem);
		if (!validItem) break;
		if (skipItem) continue;

		if (sc_DirectoryExists(diritem)) {
			inList = GraphDef_LoadDir(inWorld, diritem, inList);
		} else {
			int dnamelen = strlen(diritem);
			if (strncmp(diritem+dnamelen-9, ".scsyndef", 9) == 0) {
				inList = GraphDef_Load(inWorld, diritem, inList);
			}
		}
	}

	sc_CloseDir(dir);
	return inList;
}
Esempio n. 3
0
void World_LoadGraphDefs(World* world)
{
	GraphDef *list = 0;
	using DirName = SC_Filesystem::DirName;

	if(getenv("SC_SYNTHDEF_PATH")){
		if(world->mVerbosity > 0)
			scprintf("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{
		bfs::path path = SC_Filesystem::instance().getDirectory(DirName::UserAppSupport) / "synthdefs";
		if(world->mVerbosity > 0)
			scprintf("Loading synthdefs from default path: %s\n", SC_Codecvt::path_to_utf8_str(path).c_str());
		list = GraphDef_LoadDir(world, path, list);
		GraphDef_Define(world, list);
	}

}
bool LoadSynthDefDirCmd::Stage2()
{
	mDefs = GraphDef_LoadDir(mWorld, mFilename, mDefs);

	return true;
}