diff options
| author | oy <Tom_Adams@web.de> | 2012-01-09 01:38:45 +0100 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2012-01-09 01:38:45 +0100 |
| commit | 40735202143f8c4d2a539d1d81362c0c22e9324b (patch) | |
| tree | 9299f1fe701620bdde21a8f726f9fed4ce5e3795 /src/engine | |
| parent | de8c9b23eb8045f50205d1c5966e817584f9e300 (diff) | |
| download | zcatch-40735202143f8c4d2a539d1d81362c0c22e9324b.tar.gz zcatch-40735202143f8c4d2a539d1d81362c0c22e9324b.zip | |
cleaned up content folder creation. Closes #845
Diffstat (limited to 'src/engine')
| -rw-r--r-- | src/engine/client/client.cpp | 2 | ||||
| -rw-r--r-- | src/engine/server/server.cpp | 2 | ||||
| -rw-r--r-- | src/engine/shared/storage.cpp | 21 | ||||
| -rw-r--r-- | src/engine/storage.h | 8 |
4 files changed, 20 insertions, 13 deletions
diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 8faf1e41..0e380e40 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -2272,7 +2272,7 @@ int main(int argc, const char **argv) // ignore_convention // create the components IEngine *pEngine = CreateEngine("Teeworlds"); IConsole *pConsole = CreateConsole(CFGFLAG_CLIENT); - IStorage *pStorage = CreateStorage("Teeworlds", argc, argv); // ignore_convention + IStorage *pStorage = CreateStorage("Teeworlds", IStorage::STORAGETYPE_CLIENT, argc, argv); // ignore_convention IConfig *pConfig = CreateConfig(); IEngineSound *pEngineSound = CreateEngineSound(); IEngineInput *pEngineInput = CreateEngineInput(); diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index c15cc96e..5fa265f2 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -1675,7 +1675,7 @@ int main(int argc, const char **argv) // ignore_convention IGameServer *pGameServer = CreateGameServer(); IConsole *pConsole = CreateConsole(CFGFLAG_SERVER|CFGFLAG_ECON); IEngineMasterServer *pEngineMasterServer = CreateEngineMasterServer(); - IStorage *pStorage = CreateStorage("Teeworlds", argc, argv); // ignore_convention + IStorage *pStorage = CreateStorage("Teeworlds", IStorage::STORAGETYPE_SERVER, argc, argv); // ignore_convention IConfig *pConfig = CreateConfig(); pServer->InitRegister(&pServer->m_NetServer, pEngineMasterServer, pConsole); diff --git a/src/engine/shared/storage.cpp b/src/engine/shared/storage.cpp index c1888188..a9ccdc49 100644 --- a/src/engine/shared/storage.cpp +++ b/src/engine/shared/storage.cpp @@ -30,7 +30,7 @@ public: m_aUserdir[0] = 0; } - int Init(const char *pApplicationName, int NumArgs, const char **ppArguments) + int Init(const char *pApplicationName, int StorageType, int NumArgs, const char **ppArguments) { // get userdir fs_storage_path(pApplicationName, m_aUserdir, sizeof(m_aUserdir)); @@ -52,14 +52,17 @@ public: } // add save directories - if(m_NumPaths && (!m_aaStoragePaths[TYPE_SAVE][0] || !fs_makedir(m_aaStoragePaths[TYPE_SAVE]))) + if(StorageType != STORAGETYPE_BASIC && m_NumPaths && (!m_aaStoragePaths[TYPE_SAVE][0] || !fs_makedir(m_aaStoragePaths[TYPE_SAVE]))) { char aPath[MAX_PATH_LENGTH]; - 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))); + 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, "dumps", aPath, sizeof(aPath))); - fs_makedir(GetPath(TYPE_SAVE, "downloadedmaps", aPath, sizeof(aPath))); fs_makedir(GetPath(TYPE_SAVE, "demos", aPath, sizeof(aPath))); fs_makedir(GetPath(TYPE_SAVE, "demos/auto", aPath, sizeof(aPath))); } @@ -389,10 +392,10 @@ public: GetPath(Type, pDir, pBuffer, BufferSize); } - static IStorage *Create(const char *pApplicationName, int NumArgs, const char **ppArguments) + static IStorage *Create(const char *pApplicationName, int StorageType, int NumArgs, const char **ppArguments) { CStorage *p = new CStorage(); - if(p && p->Init(pApplicationName, NumArgs, ppArguments)) + if(p && p->Init(pApplicationName, StorageType, NumArgs, ppArguments)) { dbg_msg("storage", "initialisation failed"); delete p; @@ -402,4 +405,4 @@ public: } }; -IStorage *CreateStorage(const char *pApplicationName, int NumArgs, const char **ppArguments) { return CStorage::Create(pApplicationName, NumArgs, ppArguments); } +IStorage *CreateStorage(const char *pApplicationName, int StorageType, int NumArgs, const char **ppArguments) { return CStorage::Create(pApplicationName, StorageType, NumArgs, ppArguments); } diff --git a/src/engine/storage.h b/src/engine/storage.h index bcfb9ce2..25aa8b3e 100644 --- a/src/engine/storage.h +++ b/src/engine/storage.h @@ -12,7 +12,11 @@ public: enum { TYPE_SAVE = 0, - TYPE_ALL = -1 + TYPE_ALL = -1, + + STORAGETYPE_BASIC = 0, + STORAGETYPE_SERVER, + STORAGETYPE_CLIENT, }; virtual void ListDirectory(int Type, const char *pPath, FS_LISTDIR_CALLBACK pfnCallback, void *pUser) = 0; @@ -24,7 +28,7 @@ public: virtual void GetCompletePath(int Type, const char *pDir, char *pBuffer, unsigned BufferSize) = 0; }; -extern IStorage *CreateStorage(const char *pApplicationName, int NumArgs, const char **ppArguments); +extern IStorage *CreateStorage(const char *pApplicationName, int StorageType, int NumArgs, const char **ppArguments); #endif |