void PackAllFilesInDirectory(const String & path, const String & redusedPath) { fileSystem->SetCurrentDirectory(path.c_str()); IFileList * fileList = fileSystem->EnumFiles(); for (int file = 0; file < fileList->GetCount(); ++file) { String filename = fileList->GetFilename(file); if (fileList->IsDirectory(file)) { if ((filename != "..") && (filename != ".")) { // std::cout << "Directory: " << filename << std::endl; PackAllFilesInDirectory(path + String("/") + filename, redusedPath + String("/") + filename); } }else { String pathname = path + String("/") + filename; String printPathName = redusedPath + String("/") + filename; std::cout << "file: " << printPathName << std::endl; fileNameList.push_back(printPathName); resourceArchive.AddFile(pathname); resourceCount++; } } fileList->Release(); }
void CMountPointReader::buildDirectory() { IFileList * list = Parent->createFileList(); const u32 size = list->getFileCount(); for (u32 i=0; i < size; ++i) { core::string<c16> full = list->getFullFileName(i); full = full.subString(Path.size(), full.size() - Path.size()); if (!list->isDirectory(i)) { addItem(full, list->getFileSize(i), false, RealFileNames.size()); RealFileNames.push_back(list->getFullFileName(i)); } else { const core::string<c16> rel = list->getFileName(i); core::string<c16> pwd = Parent->getWorkingDirectory(); if (core::lastChar(pwd) != '/') pwd.append('/'); pwd.append(rel); if ( rel != "." && rel != ".." ) { addItem(full, 0, true, 0); Parent->changeWorkingDirectoryTo(pwd); buildDirectory (); Parent->changeWorkingDirectoryTo(".."); } } } list->drop(); }
//! returns true if the file maybe is able to be loaded by this class bool CArchiveLoaderMount::isALoadableFileFormat(const io::path& filename) const { io::path fname(filename); deletePathFromFilename(fname); if (!fname.size()) return true; IFileList* list = FileSystem->createFileList(); if (list) { // check if name is found as directory if (list->findFile(filename, true)) return true; } return false; }
/** * \brief Init loads list of available languages and sets default language from preferences. * \author Petar Bajic * \date January, 21 2012. */ bool CLanguages::Init() { u32 index = 0; IFileList* fileList = m_FS->createFileList(); u32 count = fileList->getFileCount(); for (u32 i=0; i<count; i++) { stringc file = fileList->getFileName(i); IXMLReader* xml = m_FS->createXMLReader(file); if (xml) { //get language name and value from file while(xml->read()) { switch(xml->getNodeType()) { case io::EXN_ELEMENT: { if (stringw("Language").equals_ignore_case(xml->getNodeName())) { TLanguage* lang = new TLanguage(); lang->name = xml->getAttributeValue(L"name"); lang->value = xml->getAttributeValue(L"value"); lang->index = index; m_ListOfAvailableLanguages.push_back(lang); index++; } } } } xml->drop(); // don't forget to delete the xml reader } } return true; }
void CMountPointReader::buildDirectory() { IFileList * list = Parent->createFileList(); if (!list) return; const uint32_t size = list->getFileCount(); for (uint32_t i=0; i < size; ++i) { io::path full = list->getFullFileName(i); full = full.subString(Path.size(), full.size() - Path.size()); if (!list->isDirectory(i)) { addItem(full, list->getFileOffset(i), list->getFileSize(i), false, RealFileNames.size()); RealFileNames.push_back(list->getFullFileName(i)); } else { const io::path rel = list->getFileName(i); RealFileNames.push_back(list->getFullFileName(i)); io::path pwd = Parent->getWorkingDirectory(); if (pwd.lastChar() != '/') pwd.append('/'); pwd.append(rel); if ( rel != "." && rel != ".." ) { addItem(full, 0, 0, true, 0); Parent->changeWorkingDirectoryTo(pwd); buildDirectory(); Parent->changeWorkingDirectoryTo(".."); } } } list->drop(); }
void CUnZipReader::buildDirectory ( ) { s32 i; s32 size; const c8 * rel; IFileList * list; list = new CFileList (); SZipFileEntry entry; size = list->getFileCount(); for ( i = 0; i!= size; ++i ) { if ( false == list->isDirectory( i ) ) { entry.zipFileName = list->getFullFileName ( i ); entry.header.FilenameLength = entry.zipFileName.size (); extractFilename(&entry); FileList.push_back(entry); } else { rel = list->getFileName ( i ); if ( strcmp ( rel, "." ) && strcmp ( rel, ".." ) ) { Parent->changeWorkingDirectoryTo ( rel ); buildDirectory (); Parent->changeWorkingDirectoryTo ( ".." ); } } } list->drop (); }