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

Unified Diff: src/base/file-utils.cc

Issue 2042253002: [icu] Support loading data file from default location (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Format Created 4 years, 6 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 | « src/base/file-utils.h ('k') | src/d8.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/base/file-utils.cc
diff --git a/src/base/file-utils.cc b/src/base/file-utils.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c1f338e35d62b646757f2961d69b9299b1c7b7f0
--- /dev/null
+++ b/src/base/file-utils.cc
@@ -0,0 +1,35 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/base/file-utils.h"
+
+#include <string.h>
+
+#include "src/base/platform/platform.h"
+
+namespace v8 {
+namespace internal {
+
+char* RelativePath(char** buffer, const char* exec_path, const char* name) {
+ DCHECK(exec_path);
+ int path_separator = static_cast<int>(strlen(exec_path)) - 1;
+ while (path_separator >= 0 &&
+ !base::OS::isDirectorySeparator(exec_path[path_separator])) {
+ path_separator--;
+ }
+ if (path_separator >= 0) {
+ int name_length = static_cast<int>(strlen(name));
+ *buffer =
+ reinterpret_cast<char*>(calloc(path_separator + name_length + 2, 1));
+ *buffer[0] = '\0';
+ strncat(*buffer, exec_path, path_separator + 1);
+ strncat(*buffer, name, name_length);
+ } else {
+ *buffer = strdup(name);
+ }
+ return *buffer;
+}
+
+} // namespace internal
+} // namespace v8
« no previous file with comments | « src/base/file-utils.h ('k') | src/d8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698