Changeset 11974


Ignore:
Timestamp:
09/05/11 21:46:20 (13 years ago)
Author:
tbretz
Message:
Fixed the case in which DoesPathExist gets no path at all and the case in which create directory gets a relative path.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/DimWriteStatistics.cc

    r11893 r11974  
    9898//! @return whether or not the given path exists
    9999//
    100 bool DimWriteStatistics::DoesPathExist(const string &path, MessageImp &log)
     100bool DimWriteStatistics::DoesPathExist(string path, MessageImp &log)
    101101{
    102102    namespace fs = boost::filesystem;
     103
     104    if (path.empty())
     105        path = ".";
    103106
    104107    const fs::path fullPath = fs::system_complete(fs::path(path));
     
    153156        throw runtime_error("Path to be created looks suspicious '"+path+"'");
    154157
    155     CreateDirectory(path.substr(0, path.find_last_of('/')));
     158    if (path.find_last_of('/')!=string::npos)
     159        CreateDirectory(path.substr(0, path.find_last_of('/')));
    156160
    157161    //path does not exist, and upper level have been created already by recusrion.
Note: See TracChangeset for help on using the changeset viewer.