Commit 2b5d1fe9 authored by kulvait's avatar kulvait

Support for canonical path, that is absolute

Added #include <experimental/filesystem> that is part of C++ 17 spec.
In C++ 13 it is however possible to link against libstdc++fs.a library using directive link_libraries(stdc++fs)
parent 4941a556
......@@ -83,6 +83,7 @@ set_target_properties(
OUTPUT_NAME "ctiol.so"
SUFFIX ""
)
target_link_libraries(CTIOL stdc++fs)#include <experimental/filesystem>
FILE( GLOB CTMAL_SRC ${CMAKE_SOURCE_DIR}/submodules/CTMAL/src/*.cpp )
include_directories(${CMAKE_SOURCE_DIR}/submodules/CTMAL/include)
......
......@@ -11,6 +11,8 @@
#include <stdarg.h> // For va_start, etc.
#include <string>
#include <sys/stat.h>
#include <experimental/filesystem>
#include "littleEndianAlignment.h"
#include "stringFormatter.h"
......
......@@ -182,8 +182,9 @@ namespace io {
std::string getParent(const std::string& path)
{
std::string absolutePath = std::experimental::filesystem::canonical(path);
// find last '/' or '\\' symbol in source string
std::string::size_type found = path.find_last_of("/\\");
std::string::size_type found = absolutePath.find_last_of("/\\");
if(found != std::string::npos)
{
return path.substr(0, found);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment