Skip to content

Commit a7ca9f0

Browse files
fix(relative-paths): Replaced has_parent_path with a simpler path check
1 parent c573c9a commit a7ca9f0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/project_parser.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -609,14 +609,13 @@ Project::Project(const Project *parent, const std::string &path, bool build) : p
609609
continue;
610610
}
611611

612-
// Skip absolute paths and paths which do not include a parent path
613-
const fs::path library_file_path{library_path};
614-
if (library_file_path.is_absolute() || !library_file_path.has_parent_path()) {
612+
// Skip paths that don't contain backwards or forwards slashes
613+
if (library_path.find_first_of(R"(\/)") == std::string::npos) {
615614
continue;
616615
}
617616

618617
// Check if the new file path exists, otherwise emit an error
619-
const auto expected_library_file_path = fs::path{path} / library_file_path;
618+
const auto expected_library_file_path = fs::path{path} / library_path;
620619
if (!fs::exists(expected_library_file_path)) {
621620
throw std::runtime_error("Attempted to link against a library file that doesn't exist for target \"" + name + "\" in \"" +
622621
key + "\": " + library_path);

0 commit comments

Comments
 (0)