-std::wstring get_relative_without_extension(
- const boost::filesystem::path& file,
- const boost::filesystem::path& relative_to)
-{
- auto result = file.stem();
-
- boost::filesystem::path current_path = file;
-
- while (true)
- {
- current_path = current_path.parent_path();
-
- if (boost::filesystem::equivalent(current_path, relative_to))
- break;
-
- if (current_path.empty())
- throw std::runtime_error("File not relative to folder");
-
- result = current_path.filename() / result;
- }
-
- return result.wstring();
-}
-