Changeset 1589 for trunk/gsinstaller


Ignore:
Timestamp:
2000-10-06T04:45:28+13:00 (24 years ago)
Author:
cs025
Message:

Changed exists method to avoid casting to Filetype; this also avoids potential
freezes when checking root folders etc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsinstaller/FilePath.cpp

    r1544 r1589  
    268268 */
    269269bool FilePath::exists()
    270 {
    271   File f(this->path);
    272   return f.exists();
     270{   OFSTRUCT of;
     271    string   testpath;
     272  bool          reply;
     273  DWORD         attrs;
     274
     275    if (this->path.length() < 5)
     276  { return true;
     277  }
     278  if (this->path[this->path.length()-1] == '\\')
     279  { testpath = this->path.substr(0, this->path.length()-1);
     280  }
     281  else
     282  { testpath = this->path;
     283  }
     284  attrs = GetFileAttributes((LPCSTR) testpath.c_str());
     285  if ((attrs == 0xffffffff) || ((attrs & FILE_ATTRIBUTE_DIRECTORY) == 0))
     286  { reply = !(OpenFile((LPCSTR) testpath.c_str(), (LPOFSTRUCT) &of, OF_EXIST) == HFILE_ERROR);
     287  }
     288  else
     289  { reply = true;
     290  }
     291  return reply;
    273292}
    274293
Note: See TracChangeset for help on using the changeset viewer.