Add support for drive letters

Windows...
This commit is contained in:
Jonathan Müller 2017-06-27 21:33:47 +02:00
commit 3677aeb564
2 changed files with 45 additions and 8 deletions

View file

@ -104,9 +104,14 @@ namespace
using cxcompile_commands = detail::raii_wrapper<CXCompileCommands, cxcompile_commands_deleter>;
bool has_drive_prefix(const std::string& file)
{
return file.size() > 2 && file[1] == ':';
}
std::string get_full_path(const detail::cxstring& dir, const std::string& file)
{
if (file.front() == '/' || file.front() == '\\')
if (has_drive_prefix(file) || file.front() == '/' || file.front() == '\\')
// absolute file
return file;
else if (dir[dir.length() - 1] != '/' && dir[dir.length() - 1] != '\\')