Changeset 2212


Ignore:
Timestamp:
Mar 12, 2010, 4:30:35 AM (14 years ago)
Author:
Peter
Message:

fixes #617

Location:
branches/0.6-stable
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/0.6-stable/test/fileutil_test.cc

    r2121 r2212  
    44  Copyright (C) 2006 Jari Häkkinen
    55  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    6   Copyright (C) 2009 Peter Johansson
     6  Copyright (C) 2009, 2010 Peter Johansson
    77
    88  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    180180  }
    181181
     182  // checking permissions on non-existence file in `/'
     183  try {
     184    suite.err() << "FileUtil Test 7" << std::endl;
     185     // intermediate dir must be unique!
     186    utility::FileUtil file("/theplu_yat_fileutil_test.sdf34DSF");
     187    if(!suite.add(file.permissions("r") == 0)) {
     188      suite.err() << "  r permission failed on " << file.path() << std::endl;
     189    }
     190  }
     191  catch (utility::IO_error e) {
     192    suite.add(false);
     193    suite.err() << e.what() << std::endl;
     194  }
     195
     196
    182197  return suite.return_value();
    183198}
  • branches/0.6-stable/yat/utility/FileUtil.cc

    r2125 r2212  
    66  Copyright (C) 2006 Jari Häkkinen
    77  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    8   Copyright (C) 2009 Peter Johansson
     8  Copyright (C) 2009, 2010 Peter Johansson
    99
    1010  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    6666    if (!exists()) {
    6767      std::string::size_type pos=path_.find_last_of('/');
    68       tryme = ( (pos!=std::string::npos) ? path_.substr(0,pos) : "." );
     68      if (pos == std::string::npos)
     69        tryme = ".";
     70      else if (pos == 0)
     71        tryme = "/";
     72      else
     73        tryme.resize(pos);
    6974    }
    7075
Note: See TracChangeset for help on using the changeset viewer.