gn: get rid of GetRealPath() function
It does the same thing of MakeAbsoluteFilePath() function,
so use base's version.
BUG=None
TEST=gn gen + gn_unittests
R=brettw@chromium.org
Change-Id: Ia6313f26ee1419846ff6c77fc1ad1d9d4102dae1
Reviewed-on: https://chromium-review.googlesource.com/503927
Reviewed-by: Brett Wilson <brettw@chromium.org>
Commit-Queue: Thiago Farina <tfarina@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#471423}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: cbbd560a5c57f738f798d9ac4462c69058358194
diff --git a/setup.cc b/setup.cc
index 22f4fce..192230d 100644
--- a/setup.cc
+++ b/setup.cc
@@ -265,21 +265,6 @@
}
#endif
-// Expands all ./, ../, and symbolic links in the given path.
-bool GetRealPath(const base::FilePath& path, base::FilePath* out) {
-#if defined(OS_POSIX)
- char buf[PATH_MAX];
- if (!realpath(path.value().c_str(), buf)) {
- return false;
- }
- *out = base::FilePath(buf);
-#else
- // Do nothing on a non-POSIX system.
- *out = path;
-#endif
- return true;
-}
-
} // namespace
const char Setup::kBuildArgFileName[] = "args.gn";
@@ -578,8 +563,8 @@
root_path = dotfile_name_.DirName();
}
- base::FilePath root_realpath;
- if (!GetRealPath(root_path, &root_realpath)) {
+ base::FilePath root_realpath = base::MakeAbsoluteFilePath(root_path);
+ if (root_realpath.empty()) {
Err(Location(), "Can't get the real root path.",
"I could not get the real path of \"" + FilePathToUTF8(root_path) +
"\".").PrintToStdout();
@@ -610,8 +595,9 @@
"\".").PrintToStdout();
return false;
}
- base::FilePath build_dir_realpath;
- if (!GetRealPath(build_dir_path, &build_dir_realpath)) {
+ base::FilePath build_dir_realpath =
+ base::MakeAbsoluteFilePath(build_dir_path);
+ if (build_dir_realpath.empty()) {
Err(Location(), "Can't get the real build dir path.",
"I could not get the real path of \"" + FilePathToUTF8(build_dir_path) +
"\".").PrintToStdout();