Changeset 1739 for trunk/gsdl/lib
- Timestamp:
- 2000-12-05T13:08:17+13:00 (23 years ago)
- Location:
- trunk/gsdl/lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/lib/cfgread.cpp
r1432 r1739 49 49 filein.get(c); 50 50 } 51 if (key.empty()) return -1;51 if (key.empty()) return 0; // blank line maybe? 52 52 return 0; 53 53 } -
trunk/gsdl/lib/fileutil.cpp
r1648 r1739 170 170 } 171 171 172 bool read_dir (const text_t &dirname, text_tset &filelist) { 173 174 WIN32_FIND_DATA FileData; 175 HANDLE hSearch; 176 char *dirpath = dirname.getcstr(); 177 strcat (dirpath, "\\*"); 178 179 hSearch = FindFirstFile(dirpath, &FileData); 180 // freeing this memory can cause a runtime error on some (particularly 181 // debug) versions of VC++ 182 delete dirpath; 183 184 if (hSearch == INVALID_HANDLE_VALUE) { 185 return false; 186 } 187 188 text_t filename = FileData.cFileName; 189 if (filename != "." && filename != ".." && filename != "CVS") 190 filelist.insert (filename); 191 192 while (FindNextFile(hSearch, &FileData)) { 193 filename = FileData.cFileName; 194 if (filename == "." || filename == ".." || filename == "CVS") 195 continue; 196 filelist.insert (filename); 197 } 198 199 FindClose(hSearch); 200 201 return true; 202 } 203 172 204 bool read_dir (const text_t &dirname, text_tarray &filelist) { 173 205 … … 217 249 } 218 250 251 bool read_dir (const text_t &dirname, text_tset &filelist) { 252 253 char *tmp = dirname.getcstr(); 254 DIR *dirin = opendir (tmp); 255 delete tmp; 256 257 if (dirin == NULL) return false; 258 259 dirent *dirp; 260 261 text_t filename; 262 while ((dirp = readdir (dirin)) != NULL) { 263 filename = dirp->d_name; 264 if (filename == "." || filename == ".." || filename == "CVS") 265 continue; 266 filelist.insert (filename); 267 } 268 closedir (dirin); 269 return true; 270 } 271 219 272 bool read_dir (const text_t &dirname, text_tarray &filelist) { 220 221 filelist.erase (filelist.begin(), filelist.end());222 273 223 274 char *tmp = dirname.getcstr(); -
trunk/gsdl/lib/fileutil.h
r1485 r1739 49 49 bool directory_exists (const text_t &dirname); 50 50 51 // note that read_dir appends to filelist, it doesn't clear 52 // it first 51 53 bool read_dir (const text_t &dirname, text_tarray &filelist); 54 bool read_dir (const text_t &dirname, text_tset &filelist); 52 55 53 56 bool file_copy (const text_t &fromfile, const text_t &tofile);
Note:
See TracChangeset
for help on using the changeset viewer.