diff --git a/codemaker/source/netmaker/csharpfile.hxx b/codemaker/source/netmaker/csharpfile.hxx index 56ba30429435..2085bb22983c 100644 --- a/codemaker/source/netmaker/csharpfile.hxx +++ b/codemaker/source/netmaker/csharpfile.hxx @@ -25,7 +25,14 @@ public: } public: - std::string getPath() const { return m_filePath.string(); } + std::string getPath() const + { +#if defined __cpp_lib_format_path + return m_filePath.display_string(); +#else + return m_filePath.string(); +#endif + } void openFile() { diff --git a/codemaker/source/rustmaker/cpp_include_manager.cxx b/codemaker/source/rustmaker/cpp_include_manager.cxx index e2a63d0f7a13..2288aecc955c 100644 --- a/codemaker/source/rustmaker/cpp_include_manager.cxx +++ b/codemaker/source/rustmaker/cpp_include_manager.cxx @@ -151,7 +151,7 @@ OString CppIncludeManager::calculateRelativeIncludePath(const CppFile& file, // If they're in the same directory, just use the filename if (target.parent_path() == currentDir) { - std::string result = target.filename().string(); + std::string result = target.filename().string(); return OString("\"" + result + "\""); } @@ -167,7 +167,7 @@ OString CppIncludeManager::calculateRelativeIncludePath(const CppFile& file, rel = fs::relative(target, baseDir); } - std::string result = rel.generic_string(); + std::string result = rel.generic_string(); return OString("\"" + result + "\""); } diff --git a/codemaker/source/rustmaker/rustfile.cxx b/codemaker/source/rustmaker/rustfile.cxx index 0b2b863d87ed..0eb0b037588f 100644 --- a/codemaker/source/rustmaker/rustfile.cxx +++ b/codemaker/source/rustmaker/rustfile.cxx @@ -23,7 +23,14 @@ RustFile::RustFile(std::string_view directory, std::string_view typeName) { } -std::string RustFile::getPath() const { return m_filePath.string(); } +std::string RustFile::getPath() const +{ +#if defined __cpp_lib_format_path + return m_filePath.display_string(); +#else + return m_filePath.string(); +#endif +} void RustFile::openFile() { @@ -255,7 +262,7 @@ void RustFile::addFileToModDeclaration() { std::filesystem::path parentDir = m_filePath.parent_path(); std::filesystem::path modFile = parentDir / "mod.rs"; - std::string fileName = m_filePath.stem().string(); // Get filename without extension + std::string fileName = m_filePath.stem().string(); // Get filename without extension if (std::filesystem::exists(modFile)) { @@ -294,12 +301,12 @@ void RustFile::ensureModFileExists(const std::filesystem::path& dirPath) { if (entry.is_directory()) { - std::string dirName = entry.path().filename().string(); + std::string dirName = entry.path().filename().string(); childModules.push_back(dirName); } else if (entry.is_regular_file() && entry.path().extension() == ".rs") { - std::string fileName = entry.path().stem().string(); + std::string fileName = entry.path().stem().string(); if (fileName != "mod") // Don't include mod.rs itself { childModules.push_back(fileName); @@ -327,7 +334,7 @@ void RustFile::ensureModFileExists(const std::filesystem::path& dirPath) if (parentDir >= outputRoot) { - std::string moduleName = dirPath.filename().string(); + std::string moduleName = dirPath.filename().string(); if (parentDir.filename() == "src") { @@ -452,9 +459,16 @@ CppFile::CppFile(std::string_view directory, std::string_view typeName, std::str { } -std::string CppFile::getPathString() const { return m_filePath.string(); } +std::string CppFile::getPathString() const +{ +#if defined __cpp_lib_format_path + return m_filePath.display_string(); +#else + return m_filePath.string(); +#endif +} std::filesystem::path CppFile::getPath() const { return m_filePath; } -std::string CppFile::getExtension() const { return m_filePath.extension().string(); } +std::string CppFile::getExtension() const { return m_filePath.extension().string(); } void CppFile::openFile() { @@ -619,14 +633,14 @@ void RustFile::processDirectoryRecursively(const std::filesystem::path& currentD { if (entry.is_directory()) { - std::string dirName = entry.path().filename().string(); + std::string dirName = entry.path().filename().string(); childModules.push_back(dirName); // Recursively process subdirectory processDirectoryRecursively(entry.path()); } else if (entry.is_regular_file() && entry.path().extension() == ".rs") { - std::string fileName = entry.path().stem().string(); + std::string fileName = entry.path().stem().string(); if (fileName != "mod" && fileName != "lib") // Don't include mod.rs or lib.rs { childModules.push_back(fileName); diff --git a/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx b/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx index a5d623d31b36..fe9f15af1473 100644 --- a/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx @@ -159,7 +159,7 @@ std::string GtvHelpers::getRelativePath(const std::string& aFilePath) if (err) return aFilePath; - return aRelPath.string(); + return aRelPath.string(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */