int scan_importfolder(char *subdir) { for(int i=0;i<127;i++) { sprintf(list_import_files[i],""); } struct al_ffblk f; bool isSomeone; int nrbe_de_fichiers=0; sprintf(rep,"%s\\import_export\\%s",mondirectory,subdir); chdir(rep); if(!al_findfirst("*.*",&f,-1)) { while(!al_findnext(&f)) { isSomeone=true; // we've found a directory! if(isSomeone && nrbe_de_fichiers<127) { sprintf(list_import_files[nrbe_de_fichiers],f.name); nrbe_de_fichiers++; } } } al_findclose(&f); //REROLL sprintf(rep,"%s\\",mondirectory); chdir (rep); return(0); }
static void _retrieve_available_languages(void) { int ret; struct al_ffblk info; _free_available_languages(); _available_languages = m_xmalloc(sizeof(char*)); TRACE("Entering retrieve section\n"); if (!(ret = al_findfirst("??text.cfg", &info, 0))) { while (!ret) { char lang_code[3]; char *lang_name = _get_lang_name_from_file(info.name, lang_code); TRACE("Found file %s\n", info.name); if (lang_name) { TRACE(" code %s, name %s\n", lang_code, lang_name); _available_languages = m_xrealloc(_available_languages, ((_num_available_languages + 1) * 2) * sizeof(char*)); _available_languages[_num_available_languages*2] = m_strdup(lang_code); _available_languages[_num_available_languages*2+1] = lang_name; _num_available_languages++; } ret = al_findnext(&info); } al_findclose(&info); } }
bool FileSystemModule::dirExists(const base::string& path) { struct al_ffblk info; int ret; base::string path2 = base::join_path(path, "*.*"); ret = al_findfirst(path2.c_str(), &info, FA_ALL); al_findclose(&info); return (ret == 0); }
/* *** SCRIPT SYMBOL: [ListBox] ListBox::FillDirList^1 *** */ void ListBox_FillDirList(GUIListBox *listbox, const char *filemask) { char searchPath[MAX_PATH]; validate_user_file_path(filemask, searchPath, false); listbox->Clear(); al_ffblk dfb; int dun = al_findfirst(searchPath, &dfb, FA_SEARCH); while (!dun) { listbox->AddItem(dfb.name); dun = al_findnext(&dfb); } al_findclose(&dfb); guis_need_update = 1; }
// Dateisuchfunktionen in verschiedenen Variationen void find_files( const Filename& fn_where, const std::string& what, DoStr dostr, void* from ) { std::string where = fn_where.get_rootful(); al_ffblk info; std::string search_for = where + what; if (al_findfirst(search_for.c_str(), &info, FA_RDONLY | FA_HIDDEN | FA_LABEL | FA_ARCH) == 0) { do { // Gefundene Datei zum Vektor hinzuf�gen Filename fn_result(where + info.name); dostr(fn_result, from); } while (al_findnext(&info) == 0); al_findclose(&info); } }
std::vector<std::string> World::createDungeonList() { std::vector<std::string> result; al_ffblk findResult; std::string pattern = ResourceHandler::getInstance()->getRealFilename("dungeons/*.txt"); if (al_findfirst(pattern.c_str(), &findResult, FA_ALL) != 0) { return result; } do { result.push_back(findResult.name); } while (al_findnext(&findResult) == 0); al_findclose(&findResult); return result; }
void find_dirs(const Filename& fn_where, DoStr dostr, void* from) { al_ffblk info; std::string where = fn_where.get_rootful(); if (where[where.size()-1] != '/') where += '/'; if (where[where.size()-1] != '*') where += '*'; if (al_findfirst(where.c_str(), &info, FA_RDONLY | FA_HIDDEN | FA_LABEL | FA_DIREC | FA_ARCH) == 0) { do { // Gefundenes Verzeichnis hinzuf�gen if ((info.attrib & FA_DIREC) == FA_DIREC && info.name[0] != '.') { std::string s = where; s.resize(s.size() -1 ); // * von der Maske abschnibbeln s += info.name; s += '/'; Filename fn_result(s); dostr(fn_result, from); } } while (al_findnext(&info) == 0); al_findclose(&info); } }
int scan_savesfolder() { struct al_ffblk f; bool isDir; int nbre_de_shows=0; sprintf(rep,"%s\\saves",mondirectory); chdir(rep); if(!al_findfirst("*.*",&f,-1)) { while(!al_findnext(&f)) { isDir=true; // check if it's a dir or a file for(int a=0;a<strlen(f.name);a++) { if(f.name[a]=='.') { isDir=false; break; } } // we've found a directory! if(isDir) { sprintf(list_save_files[nbre_de_shows],f.name); nbre_de_shows++; } } } al_findclose(&f); //reroll sprintf(rep,"%s\\",mondirectory); chdir (rep); return(0); }
void find_tree (const Filename& fn_where, const std::string& what, DoStr dostr, void* from) { std::string where = fn_where.get_rootful(); // Nach Verzeichnissen suchen al_ffblk info; if (where[where.size()-1] != '/') where += '/'; std::string search_for = where + '*'; if (al_findfirst(search_for.c_str(), &info, FA_RDONLY | FA_HIDDEN | FA_LABEL | FA_DIREC | FA_ARCH) == 0) { do { // Dies nur f�r jedes Verzeichnis au�er . und .. ausf�hren: // Neue Suche mit gleichem Vektor im gefundenen Verzeichnis if ((info.attrib & FA_DIREC) == FA_DIREC && info.name[0] != '.') { Filename fn_recurs(where + info.name + '/'); find_tree(fn_recurs, what, dostr, from); } } while (al_findnext(&info) == 0); al_findclose(&info); } // Nach Dateien suchen, die dem Suchkriterium entsprechen Filename fn_where_with_slash(where); find_files(fn_where_with_slash, what, dostr, from); }
/* *** SCRIPT SYMBOL: [ListBox] ListBox::FillSaveGameList^0 *** */ int ListBox_FillSaveGameList(GUIListBox *listbox) { listbox->Clear(); int numsaves=0; int bufix=0; al_ffblk ffb; long filedates[MAXSAVEGAMES]; char buff[200]; char searchPath[260]; sprintf(searchPath, "%s""agssave.*", saveGameDirectory); int don = al_findfirst(searchPath, &ffb, FA_SEARCH); while (!don) { bufix=0; if (numsaves >= MAXSAVEGAMES) break; // only list games .000 to .099 (to allow higher slots for other perposes) if (strstr(ffb.name,".0")==NULL) { don = al_findnext(&ffb); continue; } const char *numberExtension = strstr(ffb.name, ".0") + 1; int saveGameSlot = atoi(numberExtension); GetSaveSlotDescription(saveGameSlot, buff); listbox->AddItem(buff); listbox->saveGameIndex[numsaves] = saveGameSlot; filedates[numsaves]=(long int)ffb.time; numsaves++; don = al_findnext(&ffb); } al_findclose(&ffb); int nn; for (nn=0;nn<numsaves-1;nn++) { for (int kk=0;kk<numsaves-1;kk++) { // Date order the games if (filedates[kk] < filedates[kk+1]) { // swap them round char*tempptr = listbox->items[kk]; listbox->items[kk] = listbox->items[kk+1]; listbox->items[kk+1] = tempptr; int numtem = listbox->saveGameIndex[kk]; listbox->saveGameIndex[kk] = listbox->saveGameIndex[kk+1]; listbox->saveGameIndex[kk+1] = numtem; long numted=filedates[kk]; filedates[kk]=filedates[kk+1]; filedates[kk+1]=numted; } } } // update the global savegameindex[] array for backward compatibilty for (nn = 0; nn < numsaves; nn++) { play.filenumbers[nn] = listbox->saveGameIndex[nn]; } guis_need_update = 1; listbox->exflags |= GLF_SGINDEXVALID; if (numsaves >= MAXSAVEGAMES) return 1; return 0; }