Ignore:
Timestamp:
Nov 17, 2008, 2:27:46 AM (14 years ago)
Author:
Peter
Message:

adding a function FileUtil::lexists that uses lstat rather than stat.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/utility/FileUtil.cc

    r1487 r1627  
    9090  {
    9191    struct stat statt;
    92     if ( stat(path_.c_str(),&statt) && (errno!=ENOENT) ) {
     92    return exists_common(stat(path_.c_str(),&statt));
     93  }
     94
     95
     96  bool FileUtil::exists_common(bool failed) const
     97  {
     98    if ( failed && (errno!=ENOENT) ) {
    9399      std::stringstream ss;
    94100      ss << "stat(2) call failed with errno: " << errno;
     
    103109
    104110
     111  bool FileUtil::lexists(void) const
     112  {
     113    struct stat statt;
     114    return exists_common(lstat(path_.c_str(),&statt));
     115  }
     116
     117
    105118  const std::string& FileUtil::path(void) const
    106119  {
Note: See TracChangeset for help on using the changeset viewer.