diff options
Diffstat (limited to 'src/filesystem/file.cc')
-rw-r--r-- | src/filesystem/file.cc | 58 |
1 files changed, 1 insertions, 57 deletions
diff --git a/src/filesystem/file.cc b/src/filesystem/file.cc index f05e60c..07f8870 100644 --- a/src/filesystem/file.cc +++ b/src/filesystem/file.cc @@ -5,8 +5,7 @@ */ // project headers -#include "sys/sys.h" -#include "filesystem/filesystem.h" +#include "filesystem/file.h" namespace filesystem { @@ -14,60 +13,5 @@ File::File() {} File::~File() {} -void File::open(const char * filename, ios_base::openmode mode) { - file_name.assign(filename); - std::string fn; - - real_name.clear(); - - // if moddir is set, try the mods subdir first - if (moddir.size()) { - // try homedir + moddir - fn = homedir; - fn.append(moddir); - fn.append(filename); - std::ifstream::open(fn.c_str(), mode); - if (this->is_open()) { - real_name = fn; - con_debug << "File opened " << fn << std::endl; - return; - } - - // try datadir + moddir - fn = datadir; - fn.append(moddir); - std::ifstream::open(fn.c_str(), mode); - if (this->is_open()) { - con_debug << "File opened " << fn << std::endl; - real_name = fn; - return; - } - } - - // try homedir + basedir - fn = homedir; - fn.append(basedir); - fn.append(filename); - std::ifstream::open(fn.c_str(), mode); - if (this->is_open()) { - con_debug << "File opened " << fn << std::endl; - real_name = fn; - return; - } - - // try datadir + basedir - fn = datadir; - fn.append(basedir); - fn.append(filename); - std::ifstream::open(fn.c_str(), mode); - - if (!this->is_open()) { - con_warn << "Could not open " << filename << std::endl; - } else { - con_debug << "File opened " << fn << std::endl; - real_name = fn; - } -} - } // namespace filesystem |