void OpenDirectory(std::string path, bool isrel) { if(isrel) { currentPath += path + "/"; } initDirectory(); }
void Doom3FileSystem::initialise() { rMessage() << "filesystem initialised" << std::endl; std::string extensions = GlobalGameManager().currentGame()->getKeyValue("archivetypes"); boost::algorithm::split(_allowedExtensions, extensions, boost::algorithm::is_any_of(" ")); // Build list of dir extensions, e.g. pk4 -> pk4dir for (std::set<std::string>::const_iterator i = _allowedExtensions.begin(); i != _allowedExtensions.end(); ++i) { std::string extDir = *i + "dir"; _allowedExtensionsDir.insert(extDir); } // Get the VFS search paths from the game manager const game::IGameManager::PathList& paths = GlobalGameManager().getVFSSearchPaths(); // Initialise the paths, in the given order for (game::IGameManager::PathList::const_iterator i = paths.begin(); i != paths.end(); i++) { initDirectory(*i); } for (ObserverList::iterator i = _observers.begin(); i != _observers.end(); ++i) { (*i)->onFileSystemInitialise(); } }
QString SettingsModel::defaultDirectory(void) const { QString defaultLocation = initDirectory(QDesktopServices::storageLocation(QDesktopServices::MusicLocation)); if(defaultLocation.isEmpty()) { defaultLocation = initDirectory(QDesktopServices::storageLocation(QDesktopServices::HomeLocation)); if(defaultLocation.isEmpty()) { defaultLocation = initDirectory(QDir::currentPath()); } } return defaultLocation; }
//Sometimes going up a directory will permentantly make the directory contents blank, never happened on printf so it's probably a GPU-related issue void UpDirectory() { size_t found; currentPath = currentPath.substr(0, currentPath.length() - 1); found=currentPath.find_last_of("/\\"); currentPath = currentPath.substr(0, found + 1); initDirectory(); }
void test_initDirectory_should_initialize_4kb_directory_to_zero(void) { int i; initDirectory(); for(i = 0; i < DIR_SIZE; i++) { TEST_ASSERT_EQUAL(0, directory[i]); } }
int mksfs(int fresh) { int diskinit; //Create a new filesystem if the fresh variable is set if(fresh==1){ diskinit = init_fresh_disk(FILESYSTEMNAME, BLOCKSIZE, NUMBEROFBLOCKS); if(diskinit != 0){ //perror("Error creating disk"); exit(-1); } else { //To keep the root directory in memory initDirectory(); //Initialize SuperBlock mySuperBlock.magic = MAGIC; mySuperBlock.blockSize = BLOCKSIZE; mySuperBlock.fileSystemSize = NUMBEROFBLOCKS; mySuperBlock.iNodeTableLength = NUMBEROFINODES; mySuperBlock.rootINode = 0; //Use a block sized buffer unsigned char buffer[512]; memset(buffer,255,512); memcpy(buffer,&mySuperBlock,512); write_blocks(0,1,buffer); initializeFreeBitMap(); initializeFDTable(); //Now for the Inodes: initialize the first one: (for root dir) int numRootINode = createINode(RWE, 1, ROOT_UID, ROOT_GID, 1); readDirectory(); return 0; } } //if the free variable is not set, load else if (fresh==0) { diskinit = init_disk(FILESYSTEMNAME, BLOCKSIZE, NUMBEROFBLOCKS); if(diskinit != 0){ //perror("Error reading disc"); exit(-1); } else { return 0; } } return -1; }
/* * Class: edu_uw_apl_commons_tsk4j_filesys_FileSystem * Method: initNative * Signature: ()V */ JNIEXPORT void JNICALL Java_edu_uw_apl_commons_tsk4j_filesys_FileSystem_initNative (JNIEnv *env, jclass clazz) { jint status; status = initBlock( env ); if( status != JNI_OK ) return; status = initBlockWalk( env ); if( status != JNI_OK ) return; status = initMeta( env ); if( status != JNI_OK ) return; status = initName( env ); if( status != JNI_OK ) return; status = initFile( env ); if( status != JNI_OK ) return; status = initWalkFile( env ); if( status != JNI_OK ) return; status = initDirectory( env ); if( status != JNI_OK ) return; status = initDirectoryWalk( env ); if( status != JNI_OK ) return; status = initMetaWalk( env ); if( status != JNI_OK ) return; }
int main(int argc, char **argv) { gfxInitDefault(); C3D_Init(C3D_DEFAULT_CMDBUF_SIZE); te = new TextEngine(); te->Initialize(GFX_TOP); tb = new TextEngine(); tb->Initialize(GFX_BOTTOM); //TODO: Thanks to TheCruel (xerpi) for the solution to the GPU freezing issue on cia builds //aptHook(&apt_hook_cookie, apt_hook_func, NULL); initDirectory(); while (aptMainLoop()) { hidScanInput(); kDown = hidKeysDown(); update(); if (kDown & KEY_START) break; C3D_FrameBegin(C3D_FRAME_SYNCDRAW); te->Update(); C3D_FrameDrawOn(te->target); drawTopScreen(); tb->Update(); C3D_FrameDrawOn(tb->target); drawBottomScreen(); C3D_FrameEnd(0); } Cleanup(); return 0; }
SettingsModel::SettingsModel(void) { QString configPath = "LameXP.ini"; if(!lamexp_portable_mode()) { QString dataPath = initDirectory(QDesktopServices::storageLocation(QDesktopServices::DataLocation)); if(!dataPath.isEmpty()) { configPath = QString("%1/config.ini").arg(QDir(dataPath).canonicalPath()); } else { qWarning("SettingsModel: DataLocation could not be initialized!"); dataPath = initDirectory(QDesktopServices::storageLocation(QDesktopServices::HomeLocation)); if(!dataPath.isEmpty()) { configPath = QString("%1/LameXP.ini").arg(QDir(dataPath).canonicalPath()); } } } else { qDebug("LameXP is running in \"portable\" mode -> config in application dir!\n"); QString appPath = QFileInfo(QApplication::applicationFilePath()).canonicalFilePath(); if(appPath.isEmpty()) { appPath = QFileInfo(QApplication::applicationFilePath()).absoluteFilePath(); } if(QFileInfo(appPath).exists() && QFileInfo(appPath).isFile()) { configPath = QString("%1/%2.ini").arg(QFileInfo(appPath).absolutePath(), QFileInfo(appPath).completeBaseName()); } } //Create settings QSettings *configFile = new QSettings(configPath, QSettings::IniFormat); const QString groupKey = QString().sprintf("LameXP_%u%02u%05u", lamexp_version_major(), lamexp_version_minor(), lamexp_version_confg()); QStringList childGroups =configFile->childGroups(); //Clean-up settings while(!childGroups.isEmpty()) { QString current = childGroups.takeFirst(); QRegExp filter("^LameXP_(\\d+)(\\d\\d)(\\d\\d\\d\\d\\d)$"); if(filter.indexIn(current) >= 0) { bool ok = false; unsigned int temp = filter.cap(3).toUInt(&ok) + 10; if(ok && (temp >= lamexp_version_confg())) { continue; } } qWarning("Deleting obsolete group from config: %s", QUTF8(current)); REMOVE_GROUP(configFile, current); } //Setup settings configFile->beginGroup(groupKey); configFile->setValue(g_settingsId_versionNumber, QApplication::applicationVersion()); configFile->sync(); //Create the cache m_configCache = new SettingsCache(configFile); }