| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "base/files/file_path.h" | |
| 6 #include "base/files/file_util.h" | |
| 7 #include "base/path_service.h" | |
| 8 #include "sky/engine/config.h" | |
| 9 #include "sky/engine/v8_inspector/read_from_source_tree.h" | |
| 10 | |
| 11 namespace inspector { | |
| 12 | |
| 13 // TODO(eseidel): This is a horrible hack and only works when run | |
| 14 // inside its source tree! crbug.com/434513 | |
| 15 void ReadFileFromSourceTree(const char* name, std::string* buffer) { | |
| 16 CHECK(buffer); | |
| 17 base::FilePath root_dir; | |
| 18 PathService::Get(base::DIR_SOURCE_ROOT, &root_dir); | |
| 19 base::FilePath path = root_dir.AppendASCII("sky"); | |
| 20 path = path.AppendASCII("engine").AppendASCII("v8_inspector"); | |
| 21 | |
| 22 if (std::string("InjectedScriptSource.js") == name) | |
| 23 path = path.AppendASCII(name); | |
| 24 else if (std::string("DebuggerScript.js") == name) | |
| 25 path = path.AppendASCII(name); | |
| 26 else | |
| 27 CHECK(false); | |
| 28 | |
| 29 base::ReadFileToString(path, buffer); | |
| 30 CHECK(!buffer->empty()); | |
| 31 } | |
| 32 | |
| 33 } // namespace inspector | |
| OLD | NEW |