HeartFileFinder.cpp

00001 /*
00002 
00003 Copyright (C) University of Oxford, 2005-2011
00004 
00005 University of Oxford means the Chancellor, Masters and Scholars of the
00006 University of Oxford, having an administrative office at Wellington
00007 Square, Oxford OX1 2JD, UK.
00008 
00009 This file is part of Chaste.
00010 
00011 Chaste is free software: you can redistribute it and/or modify it
00012 under the terms of the GNU Lesser General Public License as published
00013 by the Free Software Foundation, either version 2.1 of the License, or
00014 (at your option) any later version.
00015 
00016 Chaste is distributed in the hope that it will be useful, but WITHOUT
00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00019 License for more details. The offer of Chaste under the terms of the
00020 License is subject to the License being interpreted in accordance with
00021 English Law and subject to any action against the University of Oxford
00022 being under the jurisdiction of the English Courts.
00023 
00024 You should have received a copy of the GNU Lesser General Public License
00025 along with Chaste. If not, see <http://www.gnu.org/licenses/>.
00026 
00027 */
00028 
00029 #include "HeartFileFinder.hpp"
00030 #include "Exception.hpp"
00031 
00032 
00033 HeartFileFinder::HeartFileFinder(const cp::path_type& rPath)
00034 {
00035     std::string relative_path(rPath);
00036     if (rPath.relative_to() == cp::relative_to_type::this_file)
00037     {
00038         SetPath(rPath, HeartConfig::Instance()->GetParametersFilePath());
00039     }
00040     else
00041     {
00042         RelativeTo::Value relative_to;
00043         switch (rPath.relative_to())
00044         {
00045             case cp::relative_to_type::cwd:
00046                 relative_to = RelativeTo::CWD;
00047                 break;
00048             case cp::relative_to_type::chaste_test_output:
00049                 relative_to = RelativeTo::ChasteTestOutput;
00050                 break;
00051             case cp::relative_to_type::chaste_source_root:
00052                 relative_to = RelativeTo::ChasteSourceRoot;
00053                 break;
00054             case cp::relative_to_type::absolute:
00055                 relative_to = RelativeTo::Absolute;
00056                 break;
00057             default:
00058                 NEVER_REACHED;
00059                 break;
00060         }
00061         SetPath(relative_path, relative_to);
00062     }
00063 }
Generated on Thu Dec 22 13:00:06 2011 for Chaste by  doxygen 1.6.3