Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void LuaEngine::ScriptLoadDir(char* Dirname, LUALoadScripts *pak)
- {
- #ifdef WIN32
- Log.Notice("LuaEngine", "Scanning Directory %s", Dirname);
- HANDLE hFile;
- WIN32_FIND_DATA FindData;
- memset(&FindData,0,sizeof(FindData));
- char SearchName[MAX_PATH];
- strcpy(SearchName,Dirname);
- strcat(SearchName,"\\*.*");
- hFile = FindFirstFile(SearchName,&FindData);
- FindNextFile(hFile, &FindData);
- while( FindNextFile(hFile, &FindData) )
- {
- if( FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) //Credits for this 'if' go to Cebernic from ArcScripts Team. Thanks, you saved me some work ;-)
- {
- strcpy(SearchName,Dirname);
- strcat(SearchName,"\\");
- strcat(SearchName,FindData.cFileName);
- ScriptLoadDir(SearchName, pak);
- }
- else
- {
- string fname = Dirname;
- fname += "\\";
- fname += FindData.cFileName;
- size_t len = strlen(fname.c_str());
- int i=0;
- char ext[MAX_PATH];
- while(len > 0)
- {
- ext[i++] = fname[--len];
- if(fname[len] == '.')
- break;
- }
- ext[i++] = '\0';
- if ( !_stricmp(ext,"aul.") ) pak->luaFiles.insert(fname);
- }
- }
- FindClose(hFile);
Advertisement
Add Comment
Please, Sign In to add comment