未验证 提交 4ac4b5dd 编写于 作者: M Matt Pharr 提交者: GitHub

Merge pull request #281 from shadeops/absolute_filepath_check

Check to see if a filepath exists before making absolute
......@@ -69,8 +69,11 @@ std::string RemoveExtension(std::string filename) {
std::string ResolveFilename(std::string filename) {
if (searchDirectory.empty() || filename.empty() || IsAbsolutePath(filename))
return filename;
else
return (searchDirectory / filesystem::path(filename)).make_absolute().str();
filesystem::path filepath = searchDirectory / filesystem::path(filename);
if (filepath.exists())
return filepath.make_absolute().str();
return filename;
}
std::vector<std::string> MatchingFilenames(std::string filenameBase) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册