From 7ecfd8f02bad9ebba7e32894da278a48ef9ecee9 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Tue, 15 Nov 2022 18:25:30 +0800 Subject: fix issues detected by MSVC. --- src/yue.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/yue.cpp') diff --git a/src/yue.cpp b/src/yue.cpp index 9ae4c3e..49fa3e1 100644 --- a/src/yue.cpp +++ b/src/yue.cpp @@ -146,6 +146,9 @@ static std::string compileFile(const fs::path& srcFile, yue::YueConfig conf, con (std::istreambuf_iterator(input)), std::istreambuf_iterator()); auto modulePath = srcFile.lexically_relative(workPath); + if (modulePath.empty()) { + modulePath = srcFile; + } conf.module = modulePath.string(); if (!workPath.empty()) { auto it = conf.options.find("path"); @@ -205,7 +208,11 @@ public: auto targetFile = getTargetFile(srcFile); if (!targetFile.empty()) { fs::remove(targetFile); - std::cout << "Deleted " << targetFile.lexically_relative(workPath).string() << '\n'; + auto moduleFile = targetFile.lexically_relative(workPath); + if (moduleFile.empty()) { + moduleFile = targetFile; + } + std::cout << "Deleted " << moduleFile.string() << '\n'; } break; } -- cgit v1.2.3-55-g6feb