18 #include <boost/filesystem.hpp> 19 #include <boost/algorithm/string.hpp> 35 xprintf(
Warn,
"Creating FileName object before set_io_dirs is called. No file path resolving.\n");
60 void FilePath::set_io_dirs(
const string working_dir,
const string root_input_dir,
const string input,
const string output) {
69 boost::split(dirs, output, boost::is_any_of(
"/"));
71 if ( !(*it).size() )
continue;
73 #ifdef FLOW123D_HAVE_CYGWIN 77 #endif // FLOW123D_HAVE_CYGWIN 86 boost::split(dirs, full_output, boost::is_any_of(
"/"));
88 if ( !(*it).size() )
continue;
111 if (i != std::string::npos) {
112 if (
it->second ==
"" )
xprintf(
Warn,
"Substituting placeholder %s with empty value.\n",
it->first.c_str());
120 if (path.size() == 0)
xprintf(
UsrErr,
"Path can't be empty!\n");
121 #ifdef FLOW123D_HAVE_CYGWIN 122 if (path.size() == 1)
return false;
123 return isalpha(path[0]) && (path[1] ==
':');
126 #endif // FLOW123D_HAVE_CYGWIN 131 string abs_path = boost::filesystem::current_path().string() +
"/";
132 #ifdef FLOW123D_HAVE_CYGWIN 133 boost::replace_all(abs_path,
"\\",
"/");
134 #endif // FLOW123D_HAVE_CYGWIN 142 boost::filesystem::create_directories(
151 if (!boost::filesystem::is_directory(dir)) {
152 boost::filesystem::create_directory(dir);
158 boost::filesystem::path working_path = boost::filesystem::path(working_dir);
159 boost::filesystem::path output_path = boost::filesystem::path(output);
163 boost::filesystem::path curr = boost::filesystem::current_path();
164 working_path = boost::filesystem::canonical( curr / working_path );
167 boost::filesystem::path full_path = boost::filesystem::canonical( working_path / output_path );
169 boost::filesystem::path curr = boost::filesystem::current_path();
171 #ifdef FLOW123D_HAVE_CYGWIN 173 #endif // FLOW123D_HAVE_CYGWIN
string abs_file_path_
Final absolute path to the file.
FileType
Possible types of file.
static void create_dir(string dir)
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.
FileType file_type_
File type.