Changeset 1769
- Timestamp:
- May 20, 2005, 2:28:01 AM (16 years ago)
- Location:
- to-imperative/trunk/library/Dir
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
to-imperative/trunk/library/Dir/dir.hh
r1762 r1769 23 23 #else 24 24 HANDLE hDir; 25 WIN32_FIND_DATA fd; 26 bool is_first; 25 27 #endif 26 28 -
to-imperative/trunk/library/Dir/dir.ih
r1762 r1769 20 20 } 21 21 #else 22 inline Dir::Dir (const char* _name) 22 inline Dir::Dir (const char* _name) : 23 is_first (true) 23 24 { 24 25 char name [MAX_PATH]; 25 WIN32_FIND_DATA* pfd;26 26 if (snprintf(name, MAX_PATH, "%s\\*", _name) < 0) 27 27 throw_sys_error(ERROR_FILENAME_EXCED_RANGE); 28 hDir = FindFirstFile(name, pfd);28 hDir = FindFirstFile(name, &fd); 29 29 if (hDir == INVALID_HANDLE_VALUE) 30 30 throw_sys_error(GetLastError()); … … 53 53 inline char* Dir::read() 54 54 { 55 if (hDir) return null; 56 WIN32_FIND_DATA* pfd; 57 if(!FindNextFile(hDir, pfd)) 55 if (!hDir) return null; 56 if (is_first) 58 57 { 59 DWORD error = GetLastError(); 60 if (error != ERROR_NO_MORE_FILES) throw_sys_error(error); 61 return null; 58 is_first = false; 62 59 } 63 return (pfd->cFileName); 60 else 61 { 62 if (!FindNextFile(hDir, &fd)) 63 { 64 DWORD error = GetLastError(); 65 if (error != ERROR_NO_MORE_FILES) throw_sys_error(error); 66 return null; 67 } 68 } 69 return fd.cFileName; 64 70 } 65 71 #endif -
to-imperative/trunk/library/Dir/dir_symbol.hh
r1764 r1769 13 13 { 14 14 15 RF_NEW_SYMBOL(Dir, object_term);15 RF_NEW_SYMBOL(Dir, ObjectTerm); 16 16 17 17 inline pxx::WString RF_SYMBOL(Dir)::to_string (RF_SYMBOL(Dir) const* _dir)
Note: See TracChangeset
for help on using the changeset viewer.