9 #include <boost/filesystem.hpp>
10 #include <boost/algorithm/string.hpp>
23 xprintf(
Warn,
"Creating FileName object before set_io_dirs is called. No file path resolving.\n");
33 THROW( ExcAbsOutputPath() << EI_Path( file_path ) );
42 void FilePath::set_io_dirs(
const string working_dir,
const string root_input_dir,
const string input,
const string output) {
51 boost::split(dirs, output, boost::is_any_of(
"/"));
53 if ( !(*it).size() )
continue;
68 boost::split(dirs, full_output, boost::is_any_of(
"/"));
70 if ( !(*it).size() )
continue;
93 if (i != std::string::npos) {
94 if (it->second ==
"" )
xprintf(
Warn,
"Substituting placeholder %s with empty value.\n", it->first.c_str());
102 if (path.size() == 0)
xprintf(
UsrErr,
"Path can't be empty!\n");
104 if (path.size() == 1)
return false;
105 return isalpha(path[0]) && (path[1] ==
':');
113 string abs_path = boost::filesystem::current_path().string();
115 boost::replace_all(abs_path,
"\\",
"/");
122 if (!boost::filesystem::is_directory(
output_dir)) {
123 boost::filesystem::create_directory(
output_dir);
131 boost::filesystem::path working_path = boost::filesystem::path(working_dir);
132 boost::filesystem::path output_path = boost::filesystem::path(output);
136 boost::filesystem::path curr = boost::filesystem::current_path();
137 working_path = boost::filesystem::canonical( curr / working_path );
140 boost::filesystem::path full_path = boost::filesystem::canonical( working_path / output_path );
142 boost::filesystem::path curr = boost::filesystem::current_path();
FileType
Possible types of file.
static bool create_output_dir()
string abs_file_path
Final absolute path to the file.
static void add_placeholder(string key, string value)
Add new item to place holder.
static string root_dir
Prefix path for input files (directory of the main input file).
static void create_canonical_path(const string working_dir, const string output)
static const string get_absolute_working_dir()
static void set_io_dirs(const string working_dir, const string root_input, const string input, const string output)
static std::map< string, string > placeholder
dictionary of placeholders
static string output_dir
Prefix path for output files.
static bool is_absolute_path(const string path)
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.