GLRendererRoster::GLRendererRoster(BGLView *view, ulong options) : fNextID(0), fView(view), fOptions(options), fSafeMode(false) { char parameter[32]; size_t parameterLength = sizeof(parameter); #ifdef HAIKU_TARGET_PLATFORM_HAIKU if (_kern_get_safemode_option(B_SAFEMODE_SAFE_MODE, parameter, ¶meterLength) == B_OK) #else if (_kget_safemode_option_(B_SAFEMODE_SAFE_MODE, parameter, ¶meterLength) == B_OK) #endif { if (!strcasecmp(parameter, "enabled") || !strcasecmp(parameter, "on") || !strcasecmp(parameter, "true") || !strcasecmp(parameter, "yes") || !strcasecmp(parameter, "enable") || !strcmp(parameter, "1")) fSafeMode = true; } #ifdef HAIKU_TARGET_PLATFORM_HAIKU if (_kern_get_safemode_option(B_SAFEMODE_DISABLE_USER_ADD_ONS, parameter, ¶meterLength) == B_OK) #else if (_kget_safemode_option_(B_SAFEMODE_DISABLE_USER_ADD_ONS, parameter, ¶meterLength) == B_OK) #endif { if (!strcasecmp(parameter, "enabled") || !strcasecmp(parameter, "on") || !strcasecmp(parameter, "true") || !strcasecmp(parameter, "yes") || !strcasecmp(parameter, "enable") || !strcmp(parameter, "1")) fSafeMode = true; } AddDefaultPaths(); }
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; }
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; }
GLRendererRoster::GLRendererRoster(BGLView* view, ulong options) : fNextID(0), fView(view), fOptions(options), fSafeMode(false), fABISubDirectory(NULL) { char parameter[32]; size_t parameterLength = sizeof(parameter); if (_kern_get_safemode_option(B_SAFEMODE_SAFE_MODE, parameter, ¶meterLength) == B_OK) { if (!strcasecmp(parameter, "enabled") || !strcasecmp(parameter, "on") || !strcasecmp(parameter, "true") || !strcasecmp(parameter, "yes") || !strcasecmp(parameter, "enable") || !strcmp(parameter, "1")) fSafeMode = true; } if (_kern_get_safemode_option(B_SAFEMODE_DISABLE_USER_ADD_ONS, parameter, ¶meterLength) == B_OK) { if (!strcasecmp(parameter, "enabled") || !strcasecmp(parameter, "on") || !strcasecmp(parameter, "true") || !strcasecmp(parameter, "yes") || !strcasecmp(parameter, "enable") || !strcmp(parameter, "1")) fSafeMode = true; } // We might run in compatibility mode on a system with a different ABI. The // renderers matching our ABI can usually be found in respective // subdirectories of the opengl add-ons directories. system_info info; if (get_system_info(&info) == B_OK && (info.abi & B_HAIKU_ABI_MAJOR) != (B_HAIKU_ABI & B_HAIKU_ABI_MAJOR)) { switch (B_HAIKU_ABI & B_HAIKU_ABI_MAJOR) { case B_HAIKU_ABI_GCC_2: fABISubDirectory = "gcc2"; break; case B_HAIKU_ABI_GCC_4: fABISubDirectory = "gcc4"; break; } } AddDefaultPaths(); }