Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Unified Diff: tools/gn/function_rebase_path.cc

Issue 1155713006: GN: Make file/dir resolving return errors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/function_read_file.cc ('k') | tools/gn/function_write_file.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/function_rebase_path.cc
diff --git a/tools/gn/function_rebase_path.cc b/tools/gn/function_rebase_path.cc
index 0cc32524103063196769a7d4da48ba45cf7d803b..ffe4eae565f6d49253bfde38d8af2f4de40041f5 100644
--- a/tools/gn/function_rebase_path.cc
+++ b/tools/gn/function_rebase_path.cc
@@ -71,13 +71,16 @@ Value ConvertOnePath(const Scope* scope,
base::FilePath system_path;
if (looks_like_dir) {
system_path = scope->settings()->build_settings()->GetFullPath(
- from_dir.ResolveRelativeDir(string_value,
+ from_dir.ResolveRelativeDir(value, err,
scope->settings()->build_settings()->root_path_utf8()));
} else {
system_path = scope->settings()->build_settings()->GetFullPath(
- from_dir.ResolveRelativeFile(string_value,
+ from_dir.ResolveRelativeFile(value, err,
scope->settings()->build_settings()->root_path_utf8()));
}
+ if (err->has_error())
+ return Value();
+
result = Value(function, FilePathToUTF8(system_path));
if (looks_like_dir)
MakeSlashEndingMatchInput(string_value, &result.string_value());
@@ -87,17 +90,19 @@ Value ConvertOnePath(const Scope* scope,
result = Value(function, Value::STRING);
if (looks_like_dir) {
result.string_value() = RebasePath(
- from_dir.ResolveRelativeDir(string_value,
+ from_dir.ResolveRelativeDir(value, err,
scope->settings()->build_settings()->root_path_utf8()).value(),
to_dir,
scope->settings()->build_settings()->root_path_utf8());
MakeSlashEndingMatchInput(string_value, &result.string_value());
} else {
result.string_value() = RebasePath(
- from_dir.ResolveRelativeFile(string_value,
+ from_dir.ResolveRelativeFile(value, err,
scope->settings()->build_settings()->root_path_utf8()).value(),
to_dir,
scope->settings()->build_settings()->root_path_utf8());
+ if (err->has_error())
+ return Value();
}
return result;
@@ -224,8 +229,10 @@ Value RunRebasePath(Scope* scope,
return result;
if (!args[kArgIndexDest].string_value().empty()) {
to_dir = current_dir.ResolveRelativeDir(
- args[kArgIndexDest].string_value(),
+ args[kArgIndexDest], err,
scope->settings()->build_settings()->root_path_utf8());
+ if (err->has_error())
+ return Value();
convert_to_system_absolute = false;
}
}
@@ -236,8 +243,10 @@ Value RunRebasePath(Scope* scope,
if (!args[kArgIndexFrom].VerifyTypeIs(Value::STRING, err))
return result;
from_dir = current_dir.ResolveRelativeDir(
- args[kArgIndexFrom].string_value(),
+ args[kArgIndexFrom], err,
scope->settings()->build_settings()->root_path_utf8());
+ if (err->has_error())
+ return Value();
} else {
// Default to current directory if unspecified.
from_dir = current_dir;
« no previous file with comments | « tools/gn/function_read_file.cc ('k') | tools/gn/function_write_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698