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

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
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..22a0a93f625e5be1694c061731de61c9d127d4ac 100644
--- a/tools/gn/function_rebase_path.cc
+++ b/tools/gn/function_rebase_path.cc
@@ -71,12 +71,14 @@ 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)
@@ -87,17 +89,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,7 +228,7 @@ 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());
convert_to_system_absolute = false;
}
@@ -236,7 +240,7 @@ 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());
} else {
// Default to current directory if unspecified.

Powered by Google App Engine
This is Rietveld 408576698