| OLD | NEW |
| 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 #ifndef TOOLS_GN_FILESYSTEM_UTILS_H_ | 5 #ifndef TOOLS_GN_FILESYSTEM_UTILS_H_ |
| 6 #define TOOLS_GN_FILESYSTEM_UTILS_H_ | 6 #define TOOLS_GN_FILESYSTEM_UTILS_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 bool ContentsEqual(const base::FilePath& file_path, const std::string& data); | 168 bool ContentsEqual(const base::FilePath& file_path, const std::string& data); |
| 169 | 169 |
| 170 // Writes given stream contents to the given file if it differs from existing | 170 // Writes given stream contents to the given file if it differs from existing |
| 171 // file contents. Returns true if new contents was successfully written or | 171 // file contents. Returns true if new contents was successfully written or |
| 172 // existing file contents doesn't need updating, false on write error. |err| is | 172 // existing file contents doesn't need updating, false on write error. |err| is |
| 173 // set on write error if not nullptr. | 173 // set on write error if not nullptr. |
| 174 bool WriteFileIfChanged(const base::FilePath& file_path, | 174 bool WriteFileIfChanged(const base::FilePath& file_path, |
| 175 const std::string& data, | 175 const std::string& data, |
| 176 Err* err); | 176 Err* err); |
| 177 | 177 |
| 178 // Writes given stream contents to the given file. Returns true if data was |
| 179 // successfully written, false on write |err| is set on error if not nullptr. |
| 180 bool WriteFile(const base::FilePath& file_path, const std::string& data, |
| 181 Err* err); |
| 182 |
| 178 // ----------------------------------------------------------------------------- | 183 // ----------------------------------------------------------------------------- |
| 179 | 184 |
| 180 enum class BuildDirType { | 185 enum class BuildDirType { |
| 181 // Returns the root toolchain dir rather than the generated or output | 186 // Returns the root toolchain dir rather than the generated or output |
| 182 // subdirectories. This is valid only for the toolchain directory getters. | 187 // subdirectories. This is valid only for the toolchain directory getters. |
| 183 // Asking for this for a target or source dir makes no sense. | 188 // Asking for this for a target or source dir makes no sense. |
| 184 TOOLCHAIN_ROOT, | 189 TOOLCHAIN_ROOT, |
| 185 | 190 |
| 186 // Generated file directory. | 191 // Generated file directory. |
| 187 GEN, | 192 GEN, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 OutputFile GetBuildDirForTargetAsOutputFile(const Target* target, | 257 OutputFile GetBuildDirForTargetAsOutputFile(const Target* target, |
| 253 BuildDirType type); | 258 BuildDirType type); |
| 254 | 259 |
| 255 // Returns the scope's current directory. | 260 // Returns the scope's current directory. |
| 256 SourceDir GetScopeCurrentBuildDirAsSourceDir(const Scope* scope, | 261 SourceDir GetScopeCurrentBuildDirAsSourceDir(const Scope* scope, |
| 257 BuildDirType type); | 262 BuildDirType type); |
| 258 // Lack of OutputDir version is due only to it not currently being needed, | 263 // Lack of OutputDir version is due only to it not currently being needed, |
| 259 // please add one if you need it. | 264 // please add one if you need it. |
| 260 | 265 |
| 261 #endif // TOOLS_GN_FILESYSTEM_UTILS_H_ | 266 #endif // TOOLS_GN_FILESYSTEM_UTILS_H_ |
| OLD | NEW |