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

Unified Diff: tools/gn/filesystem_utils.cc

Issue 2265833002: Implement `gn analyze`. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: do not pretty print the written json; this gets around crlf issues Created 4 years, 4 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/filesystem_utils.h ('k') | tools/gn/gn.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/filesystem_utils.cc
diff --git a/tools/gn/filesystem_utils.cc b/tools/gn/filesystem_utils.cc
index 6152ae04656a5b40a6adc58f1391da28bcb74849..44fa0eb505f523cbd6ea039f737d874326c1bd28 100644
--- a/tools/gn/filesystem_utils.cc
+++ b/tools/gn/filesystem_utils.cc
@@ -336,6 +336,10 @@ bool IsPathAbsolute(const base::StringPiece& path) {
return true;
}
+bool IsPathSourceAbsolute(const base::StringPiece& path) {
+ return (path.size() >= 2 && path[0] == '/' && path[1] == '/');
+}
+
bool MakeAbsolutePathRelativeIfPossible(const base::StringPiece& source_root,
const base::StringPiece& path,
std::string* dest) {
@@ -754,6 +758,11 @@ bool WriteFileIfChanged(const base::FilePath& file_path,
if (ContentsEqual(file_path, data))
return true;
+ return WriteFile(file_path, data, err);
+}
+
+bool WriteFile(const base::FilePath& file_path, const std::string& data,
+ Err* err) {
// Create the directory if necessary.
if (!base::CreateDirectory(file_path.DirName())) {
if (err) {
« no previous file with comments | « tools/gn/filesystem_utils.h ('k') | tools/gn/gn.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698