summaryrefslogtreecommitdiff
path: root/linker/linker_utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linker/linker_utils.cpp')
-rw-r--r--linker/linker_utils.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/linker/linker_utils.cpp b/linker/linker_utils.cpp
index db43d38f8..1b0c4e4c9 100644
--- a/linker/linker_utils.cpp
+++ b/linker/linker_utils.cpp
@@ -66,9 +66,18 @@ bool file_is_in_dir(const std::string& file, const std::string& dir) {
const char* haystack = file.c_str();
size_t needle_len = strlen(needle);
- return (strncmp(haystack, needle, needle_len) == 0 &&
- haystack[needle_len] == '/' &&
- strchr(haystack + needle_len + 1, '/') == nullptr);
+ return strncmp(haystack, needle, needle_len) == 0 &&
+ haystack[needle_len] == '/' &&
+ strchr(haystack + needle_len + 1, '/') == nullptr;
+}
+
+bool file_is_under_dir(const std::string& file, const std::string& dir) {
+ const char* needle = dir.c_str();
+ const char* haystack = file.c_str();
+ size_t needle_len = strlen(needle);
+
+ return strncmp(haystack, needle, needle_len) == 0 &&
+ haystack[needle_len] == '/';
}
const char* const kZipFileSeparator = "!/";