Lines Matching refs:path
55 static bool IsAbsolute(const std::string &path)
58 return !path.empty() && path[0] == '/';
60 return fs::path(path).is_absolute();
69 return (fs::path(a) / b).string();
73 std::string ParentPath(const std::string &path)
76 auto pos = path.find('/');
77 return pos == std::string::npos ? path : path.substr(0, pos);
79 return fs::path(path).parent_path().string();
83 static std::string MakeAbsolute(const std::string &path, const std::string &base)
85 return IsAbsolute(path) ? path : JoinPaths(base, path);
92 ASSERT(fs::path(base_).is_absolute());
102 fs::path relative;
114 bool ArkTsConfig::Pattern::Match(const std::string &path) const
116 ASSERT(fs::path(path).is_absolute());
117 fs::path value = fs::path(value_);
134 auto res = std::regex_match(path, m, std::regex(pattern));
155 if (!Check(!basePath.empty(), "Can't resolve config path: ", extends)) {
199 if (!Check(values, "Invalid value for 'path' with key '", key, "'")) {
234 if (!Check(data != nullptr, "Invalid value for for dynamic path with key '", key, "'")) {
239 if (!Check(langValue != nullptr, "Invalid '", LANGUAGE, "' value for dynamic path with key '", key, "'")) {
244 if (!Check(lang && lang->IsDynamic(), "Invalid '", LANGUAGE, "' value for dynamic path with key '", key,
255 if (!Check(hasDeclValue != nullptr, "Invalid '", HAS_DECL, "' value for dynamic path with key '", key, "'")) {
261 if (!Check(res.second, "Duplicated dynamic path '", key, "' for key '", key, "'")) {
288 static std::optional<std::string> ReadConfig(const std::string &path)
290 std::ifstream inputStream(path);
291 if (!Check(!inputStream.fail(), "Failed to open file: ", path)) {
304 auto path = options->get()->GetValue<JsonObject::StringT>(key);
305 dst = ((path != nullptr) ? *path : "");
387 // Remove '/' and '*' from the end of path
388 static std::string TrimPath(const std::string &path)
390 std::string trimmedPath = path;
397 std::optional<std::string> ArkTsConfig::ResolvePath(const std::string &path) const
401 size_t pos = path.rfind(trimmedAlias, 0);
403 std::string resolved = path;
414 static bool MatchExcludes(const fs::path &path, const std::vector<ArkTsConfig::Pattern> &excludes)
417 if (e.Match(path.string())) {
424 static std::vector<fs::path> GetSourceList(const std::shared_ptr<ArkTsConfig> &arktsConfig)
431 auto configDir = fs::absolute(fs::path(arktsConfig->ConfigPath())).parent_path();
441 std::vector<fs::path> sourceList;
443 if (!Check(fs::exists(f) && fs::path(f).has_filename(), "No such file: ", f)) {
453 auto traverseRoot = fs::path(include.GetSearchRoot());
464 if (include.Match(dirEntry.path().string()) && !MatchExcludes(dirEntry, excludes)) {
474 static fs::path Relative(const fs::path &src, const fs::path &base)
476 fs::path tmpPath = src;
477 fs::path relPath;
481 return fs::path();
488 // Compute path to destination file and create subfolders
489 static fs::path ComputeDestination(const fs::path &src, const fs::path &rootDir, const fs::path &outDir)