Revert of GN: Normalize the build directory path (patchset #1 id:1 of https://codereview.chromium.org/1707293002/ )
Reason for revert:
Doesn't work when the build directory does not exit.
Original issue's description:
> GN: Normalize the build directory path
>
> BUG=586906
> TEST=ln -s /tmp out_tmp && out/gn/gn gen //out_tmp/Release
>
> Committed: https://crrev.com/62b5ce373ce17228a3c06f3e32ff329180e89921
> Cr-Commit-Position: refs/heads/master@{#376288}
TBR=brettw@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=586906
Review URL: https://codereview.chromium.org/1723453002
Cr-Original-Commit-Position: refs/heads/master@{#376710}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 14bbbf277bf50e0103891dd2ad80aa8d091fe6d5
diff --git a/tools/gn/setup.cc b/tools/gn/setup.cc
index bad4b7b..79814e6 100644
--- a/tools/gn/setup.cc
+++ b/tools/gn/setup.cc
@@ -226,21 +226,6 @@
}
#endif
-// Expands all ./, ../, and symbolic links in the given path.
-bool NormalizePath(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";
@@ -528,16 +513,9 @@
root_path = dotfile_name_.DirName();
}
- base::FilePath root_path_normalized;
- if (!NormalizePath(root_path, &root_path_normalized)) {
- Err(Location(), "Can't normalize the root path.",
- "I could not normalize the path \"" + FilePathToUTF8(root_path) + "\".")
- .PrintToStdout();
- return false;
- }
if (scheduler_.verbose_logging())
- scheduler_.Log("Using source root", FilePathToUTF8(root_path_normalized));
- build_settings_.SetRootPath(root_path_normalized);
+ scheduler_.Log("Using source root", FilePathToUTF8(root_path));
+ build_settings_.SetRootPath(root_path);
return true;
}
@@ -553,21 +531,11 @@
return false;
}
- base::FilePath build_dir_path = build_settings_.GetFullPath(resolved);
- base::FilePath build_dir_path_normalized;
- if (!NormalizePath(build_dir_path, &build_dir_path_normalized)) {
- Err(Location(), "Can't normalize the root path.",
- "I could not normalize the path \"" + FilePathToUTF8(build_dir_path) +
- "\".").PrintToStdout();
- return false;
- }
- resolved = SourceDirForPath(build_settings_.root_path(),
- build_dir_path_normalized);
-
if (scheduler_.verbose_logging())
scheduler_.Log("Using build dir", resolved.value());
if (require_exists) {
+ base::FilePath build_dir_path = build_settings_.GetFullPath(resolved);
if (!base::PathExists(build_dir_path.Append(
FILE_PATH_LITERAL("build.ninja")))) {
Err(Location(), "Not a build directory.",