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

Side by Side Diff: tools/gn/setup.cc

Issue 1708513002: GN: Normalize the build directory path (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "tools/gn/setup.h" 5 #include "tools/gn/setup.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <sstream> 9 #include <sstream>
10 #include <utility> 10 #include <utility>
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 } 514 }
515 515
516 if (scheduler_.verbose_logging()) 516 if (scheduler_.verbose_logging())
517 scheduler_.Log("Using source root", FilePathToUTF8(root_path)); 517 scheduler_.Log("Using source root", FilePathToUTF8(root_path));
518 build_settings_.SetRootPath(root_path); 518 build_settings_.SetRootPath(root_path);
519 519
520 return true; 520 return true;
521 } 521 }
522 522
523 bool Setup::FillBuildDir(const std::string& build_dir, bool require_exists) { 523 bool Setup::FillBuildDir(const std::string& build_dir, bool require_exists) {
524 #if defined(OS_POSIX)
525 // Expand all ./, ../, and symbolic links in build_dir.
526 char realpath_buf[PATH_MAX];
527 if (!realpath(build_dir.c_str(), realpath_buf)) {
528 Err(Location(), "Can't normalize the build directory path.",
529 strerror(errno)) .PrintToStdout();
530 return false;
531 }
532 const std::string build_dir_realpath = realpath_buf;
533 #else
534 const std::string& build_dir_realpath = build_dir;
535 #endif
536
524 Err err; 537 Err err;
525 SourceDir resolved = 538 SourceDir resolved =
526 SourceDirForCurrentDirectory(build_settings_.root_path()). 539 SourceDirForCurrentDirectory(build_settings_.root_path()).
527 ResolveRelativeDir(Value(nullptr, build_dir), &err, 540 ResolveRelativeDir(Value(nullptr, build_dir_realpath), &err,
528 build_settings_.root_path_utf8()); 541 build_settings_.root_path_utf8());
529 if (err.has_error()) { 542 if (err.has_error()) {
530 err.PrintToStdout(); 543 err.PrintToStdout();
531 return false; 544 return false;
532 } 545 }
533 546
534 if (scheduler_.verbose_logging()) 547 if (scheduler_.verbose_logging())
535 scheduler_.Log("Using build dir", resolved.value()); 548 scheduler_.Log("Using build dir", resolved.value());
536 549
537 if (require_exists) { 550 if (require_exists) {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 if (err.has_error()) { 697 if (err.has_error()) {
685 err.PrintToStdout(); 698 err.PrintToStdout();
686 return false; 699 return false;
687 } 700 }
688 } 701 }
689 build_settings_.set_exec_script_whitelist(std::move(whitelist)); 702 build_settings_.set_exec_script_whitelist(std::move(whitelist));
690 } 703 }
691 704
692 return true; 705 return true;
693 } 706 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698