Esempio n. 1
0
	int Init(const char *pApplicationName, int StorageType, int NumArgs, const char **ppArguments)
	{
		// get userdir
		fs_storage_path(pApplicationName, m_aUserdir, sizeof(m_aUserdir));

		// get datadir
		FindDatadir(ppArguments[0]);

		// get currentdir
		if(!fs_getcwd(m_aCurrentdir, sizeof(m_aCurrentdir)))
			m_aCurrentdir[0] = 0;

		// load paths from storage.cfg
		LoadPaths(ppArguments[0]);

		if(!m_NumPaths)
		{
			dbg_msg("storage", "using standard paths");
			AddDefaultPaths();
		}

		// add save directories
		if(StorageType != STORAGETYPE_BASIC)
		{
			if(m_NumPaths && (!m_aaStoragePaths[TYPE_SAVE][0] || !fs_makedir(m_aaStoragePaths[TYPE_SAVE])))
			{
				char aPath[MAX_PATH_LENGTH];
				if(StorageType == STORAGETYPE_CLIENT)
				{
					fs_makedir(GetPath(TYPE_SAVE, "screenshots", aPath, sizeof(aPath)));
					fs_makedir(GetPath(TYPE_SAVE, "screenshots/auto", aPath, sizeof(aPath)));
					fs_makedir(GetPath(TYPE_SAVE, "maps", aPath, sizeof(aPath)));
					fs_makedir(GetPath(TYPE_SAVE, "downloadedmaps", aPath, sizeof(aPath)));
					fs_makedir(GetPath(TYPE_SAVE, "downloadedassets", aPath, sizeof(aPath)));
					fs_makedir(GetPath(TYPE_SAVE, "downloadedassets/universes", aPath, sizeof(aPath)));
					fs_makedir(GetPath(TYPE_SAVE, "downloadedassets/worlds", aPath, sizeof(aPath)));
					fs_makedir(GetPath(TYPE_SAVE, "downloadedassets/lands", aPath, sizeof(aPath)));
					fs_makedir(GetPath(TYPE_SAVE, "skins", aPath, sizeof(aPath)));
				}
				fs_makedir(GetPath(TYPE_SAVE, "assets", aPath, sizeof(aPath)));
				fs_makedir(GetPath(TYPE_SAVE, "assets/universes", aPath, sizeof(aPath)));
				fs_makedir(GetPath(TYPE_SAVE, "assets/worlds", aPath, sizeof(aPath)));
				fs_makedir(GetPath(TYPE_SAVE, "assets/lands", aPath, sizeof(aPath)));
				fs_makedir(GetPath(TYPE_SAVE, "editorresources", aPath, sizeof(aPath)));
				fs_makedir(GetPath(TYPE_SAVE, "dumps", aPath, sizeof(aPath)));
				fs_makedir(GetPath(TYPE_SAVE, "demos", aPath, sizeof(aPath)));
				fs_makedir(GetPath(TYPE_SAVE, "demos/auto", aPath, sizeof(aPath)));
				fs_makedir(GetPath(TYPE_SAVE, "configs", aPath, sizeof(aPath)));
			}
			else
			{
				dbg_msg("storage", "unable to create save directory");
				return 1;
			}
		}

		return m_NumPaths ? 0 : 1;
	}
Esempio n. 2
0
	int Init(const char *pApplicationName, int StorageType, int NumArgs, const char **ppArguments)
	{
		// get userdir
		fs_storage_path(pApplicationName, m_aUserdir, sizeof(m_aUserdir));

		// get datadir
		FindDatadir(ppArguments[0]);

		// get currentdir
		if(!fs_getcwd(m_aCurrentdir, sizeof(m_aCurrentdir)))
			m_aCurrentdir[0] = 0;

		// load paths from storage.cfg
		LoadPaths(ppArguments[0]);

		if(!m_NumPaths)
		{
			dbg_msg("storage", "using standard paths");
			AddDefaultPaths();
		}

		// add save directories
		if(StorageType != STORAGETYPE_BASIC && m_NumPaths && (!m_aaStoragePaths[TYPE_SAVE][0] || !fs_makedir(m_aaStoragePaths[TYPE_SAVE])))
		{
			char aPath[MAX_PATH_LENGTH];
			if(StorageType == STORAGETYPE_CLIENT)
			{
				fs_makedir(GetPath(TYPE_SAVE, "screenshots", aPath, sizeof(aPath)));
				fs_makedir(GetPath(TYPE_SAVE, "screenshots/auto", aPath, sizeof(aPath)));
				fs_makedir(GetPath(TYPE_SAVE, "screenshots/auto/stats", aPath, sizeof(aPath)));
				fs_makedir(GetPath(TYPE_SAVE, "maps", aPath, sizeof(aPath)));
				fs_makedir(GetPath(TYPE_SAVE, "downloadedmaps", aPath, sizeof(aPath)));
				fs_makedir(GetPath(TYPE_SAVE, "identities", aPath, sizeof(aPath)));

				fs_makedir(GetPath(TYPE_SAVE, "tmp", aPath, sizeof(aPath)));
				fs_makedir(GetPath(TYPE_SAVE, "tmp/cache", aPath, sizeof(aPath)));

				fs_makedir("rsa");
			}
			fs_makedir(GetPath(TYPE_SAVE, "dumps", aPath, sizeof(aPath)));
			fs_makedir(GetPath(TYPE_SAVE, "dumps/console_local", aPath, sizeof(aPath)));
			fs_makedir(GetPath(TYPE_SAVE, "dumps/console_remote", aPath, sizeof(aPath)));
			fs_makedir(GetPath(TYPE_SAVE, "dumps/memory", aPath, sizeof(aPath)));
			fs_makedir(GetPath(TYPE_SAVE, "dumps/tilelayer", aPath, sizeof(aPath)));
			fs_makedir(GetPath(TYPE_SAVE, "dumps/network", aPath, sizeof(aPath)));
			fs_makedir(GetPath(TYPE_SAVE, "demos", aPath, sizeof(aPath)));
			fs_makedir(GetPath(TYPE_SAVE, "demos/auto", aPath, sizeof(aPath)));
			fs_makedir(GetPath(TYPE_SAVE, "editor", aPath, sizeof(aPath)));
			fs_makedir(GetPath(TYPE_SAVE, "ghosts", aPath, sizeof(aPath)));
		}

		return m_NumPaths ? 0 : 1;
	}
Esempio n. 3
0
	int Init(const char *pApplicationName, const char *pArgv0)
	{
		char aPath[1024] = {0};
		fs_storage_path(pApplicationName, m_aApplicationSavePath, sizeof(m_aApplicationSavePath));
		if(fs_makedir(m_aApplicationSavePath) == 0)
		{		
			str_format(aPath, sizeof(aPath), "%s/screenshots", m_aApplicationSavePath);
			fs_makedir(aPath);

			str_format(aPath, sizeof(aPath), "%s/maps", m_aApplicationSavePath);
			fs_makedir(aPath);

			str_format(aPath, sizeof(aPath), "%s/downloadedmaps", m_aApplicationSavePath);
			fs_makedir(aPath);

			str_format(aPath, sizeof(aPath), "%s/demos", m_aApplicationSavePath);
			fs_makedir(aPath);
		}
		
		return FindDatadir(pArgv0);
	}