Fix trailing slashes not to rely on boost
This commit is contained in:
parent
d63cb0943f
commit
186f478dfc
1 changed files with 5 additions and 3 deletions
|
@ -55,13 +55,15 @@ std::cout << "Warning: " << stream << std::endl
|
||||||
|
|
||||||
void CreateDirectory(std::string output_path)
|
void CreateDirectory(std::string output_path)
|
||||||
{
|
{
|
||||||
|
// Removing trailing separators, as that causes issues with directory creation in unix
|
||||||
|
while (output_path[output_path.size() - 1] == '/' || output_path[output_path.size() - 1] == '\\')
|
||||||
|
{
|
||||||
|
output_path = output_path.substr(0, output_path.size() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
// Creating the right directory structure
|
// Creating the right directory structure
|
||||||
auto p = path(output_path);
|
auto p = path(output_path);
|
||||||
|
|
||||||
// Deal with a case where directory ends with a \\ or /
|
|
||||||
p = p.remove_trailing_separator();
|
|
||||||
|
|
||||||
if (!boost::filesystem::exists(p))
|
if (!boost::filesystem::exists(p))
|
||||||
{
|
{
|
||||||
bool success = boost::filesystem::create_directories(p);
|
bool success = boost::filesystem::create_directories(p);
|
||||||
|
|
Loading…
Reference in a new issue