Changeset 1419 for trunk/gsdl/lib
- Timestamp:
- 2000-08-17T17:07:43+12:00 (24 years ago)
- Location:
- trunk/gsdl/lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/lib/fileutil.cpp
r1310 r1419 147 147 #include <windows.h> 148 148 149 bool read_dir (const text_t &dirname, text_tarray &filelist) {149 bool directory_exists (const text_t &dirname) { 150 150 151 151 WIN32_FIND_DATA FileData; … … 155 155 156 156 hSearch = FindFirstFile(dirpath, &FileData); 157 if (hSearch == INVALID_HANDLE_VALUE) return false; 157 delete dirpath; 158 159 if (hSearch == INVALID_HANDLE_VALUE) { 160 return false; 161 } 162 return true; 163 } 164 165 bool read_dir (const text_t &dirname, text_tarray &filelist) { 166 167 WIN32_FIND_DATA FileData; 168 HANDLE hSearch; 169 char *dirpath = dirname.getcstr(); 170 strcat (dirpath, "\\*"); 171 172 hSearch = FindFirstFile(dirpath, &FileData); 173 delete dirpath; 174 175 if (hSearch == INVALID_HANDLE_VALUE) { 176 return false; 177 } 158 178 159 179 text_t filename = FileData.cFileName; … … 176 196 177 197 #include <dirent.h> 198 199 bool directory_exists (const text_t &dirname) { 200 201 char *tmp = dirname.getcstr(); 202 DIR *dirin = opendir (tmp); 203 delete tmp; 204 205 if (dirin == NULL) return false; 206 closedir (dirin); 207 return true; 208 } 178 209 179 210 bool read_dir (const text_t &dirname, text_tarray &filelist) { -
trunk/gsdl/lib/fileutil.h
r1310 r1419 44 44 bool file_writable (const text_t &filename); 45 45 46 // returns true if directory exists 47 bool directory_exists (const text_t &dirname); 48 46 49 bool read_dir (const text_t &dirname, text_tarray &filelist); 47 50
Note:
See TracChangeset
for help on using the changeset viewer.