Changeset 1769


Ignore:
Timestamp:
May 20, 2005, 2:28:01 AM (16 years ago)
Author:
orlov
Message:
  • Fixes in Windows version.
Location:
to-imperative/trunk/library/Dir
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • to-imperative/trunk/library/Dir/dir.hh

    r1762 r1769  
    2323#else
    2424  HANDLE hDir;
     25  WIN32_FIND_DATA fd;
     26  bool is_first;
    2527#endif
    2628
  • to-imperative/trunk/library/Dir/dir.ih

    r1762 r1769  
    2020}
    2121#else
    22 inline Dir::Dir (const char* _name)
     22inline Dir::Dir (const char* _name) :
     23  is_first (true)
    2324{
    2425  char name [MAX_PATH];
    25   WIN32_FIND_DATA* pfd;
    2626  if (snprintf(name, MAX_PATH, "%s\\*", _name) < 0)
    2727    throw_sys_error(ERROR_FILENAME_EXCED_RANGE);
    28   hDir = FindFirstFile(name, pfd);
     28  hDir = FindFirstFile(name, &fd);
    2929  if (hDir == INVALID_HANDLE_VALUE)
    3030    throw_sys_error(GetLastError());
     
    5353inline char* Dir::read()
    5454{
    55   if (hDir) return null;
    56   WIN32_FIND_DATA* pfd;
    57   if(!FindNextFile(hDir, pfd))
     55  if (!hDir) return null;
     56  if (is_first)
    5857  {
    59     DWORD error = GetLastError();
    60     if (error != ERROR_NO_MORE_FILES) throw_sys_error(error);
    61     return null;
     58    is_first = false;
    6259  }
    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;
    6470}
    6571#endif
  • to-imperative/trunk/library/Dir/dir_symbol.hh

    r1764 r1769  
    1313{
    1414
    15 RF_NEW_SYMBOL(Dir, object_term);
     15RF_NEW_SYMBOL(Dir, ObjectTerm);
    1616
    1717inline pxx::WString RF_SYMBOL(Dir)::to_string (RF_SYMBOL(Dir) const* _dir)
Note: See TracChangeset for help on using the changeset viewer.