From 8ec5b3e6ef2e7e5c3adaa5accb375676b1c09ff0 Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 22 Feb 2024 07:14:55 -0800 Subject: Add API for querying and reusing precompiled binary modules. (#3614) --- source/core/slang-io.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source/core/slang-io.cpp') diff --git a/source/core/slang-io.cpp b/source/core/slang-io.cpp index c546dd059..c08f499b9 100644 --- a/source/core/slang-io.cpp +++ b/source/core/slang-io.cpp @@ -36,6 +36,7 @@ #include /* PATH_MAX */ #include #include +#include namespace Slang { @@ -660,6 +661,17 @@ namespace Slang #endif } + String Path::getRelativePath(String base, String path) + { + std::filesystem::path p1(base.getBuffer()); + std::filesystem::path p2(path.getBuffer()); + std::error_code ec; + auto result = std::filesystem::relative(p2, p1, ec); + if (ec) + return path; + return String(UnownedStringSlice(result.generic_u8string().c_str())); + } + SlangResult Path::remove(const String& path) { #ifdef _WIN32 -- cgit v1.2.3