Chromium Code Reviews| Index: client/deps/glbench/src/utils.cc |
| diff --git a/client/deps/glbench/src/utils.cc b/client/deps/glbench/src/utils.cc |
| index 5340d7ba4df22df0fb8ef6374326df96e0108a67..a214f5b6e1bbd1375ae6487c303f8979440c48d1 100644 |
| --- a/client/deps/glbench/src/utils.cc |
| +++ b/client/deps/glbench/src/utils.cc |
| @@ -10,11 +10,25 @@ |
| #include "utils.h" |
| +#include "base/file_path.h" |
| #include "base/logging.h" |
| #include "main.h" |
| -void *MmapFile(const char *name, size_t *length) { |
| - int fd = open(name, O_RDONLY); |
| +FilePath *g_base_path = new FilePath(); |
| + |
| +// Sets the base path for MmapFile to `dirname($argv0)`/$relative. |
| +void SetBasePathFromArgv0(const char* argv0, const char* relative) { |
|
Alexey Marinichev
2010/03/12 19:22:59
Everywhere else, including line 17, pointers are d
|
| + if (g_base_path) { |
| + delete g_base_path; |
| + } |
| + FilePath argv0_path = FilePath(argv0).DirName(); |
| + FilePath base_path = relative ? argv0_path.Append(relative) : argv0_path; |
| + g_base_path = new FilePath(base_path); |
| +} |
| + |
| +void *MmapFile(const char* name, size_t* length) { |
|
Alexey Marinichev
2010/03/12 19:22:59
Same thing here.
|
| + FilePath filename = g_base_path->Append(name); |
| + int fd = open(filename.value().c_str(), O_RDONLY); |
| if (fd == -1) |
| return NULL; |