30 lines
691 B
C++
30 lines
691 B
C++
#include "file_utils.h"
|
|
#include "lib/os/os.h"
|
|
#include "bts_assert.h"
|
|
|
|
#include <boost/filesystem.hpp>
|
|
#include <boost/algorithm/string/predicate.hpp>
|
|
#include <boost/algorithm/string/replace.hpp>
|
|
|
|
namespace bts {
|
|
namespace utils {
|
|
|
|
bool create_if_not_there (std::string const &path)
|
|
{
|
|
if (!boost::filesystem::exists (path)) {
|
|
bts_assert_msg (boost::filesystem::create_directories (path), "Unable to create directory");
|
|
return false;
|
|
}
|
|
else
|
|
return true;
|
|
}
|
|
|
|
std::string normalize_data_path (std::string const &input_path)
|
|
{
|
|
std::string result (input_path);
|
|
boost::algorithm::replace_first (result,"$data_path", os::bts_data_path ());
|
|
return result;
|
|
}
|
|
|
|
}}
|