diff options
author | Bert Belder <bertbelder@gmail.com> | 2018-11-01 13:05:21 +0100 |
---|---|---|
committer | Bert Belder <bertbelder@gmail.com> | 2018-11-01 13:34:16 +0100 |
commit | b73b651612233dc61d006f3dbed7f29b063fa289 (patch) | |
tree | d987ef27f14b308c076b39adae77643bc9d7c11a /libdeno/test.cc | |
parent | 9aa3640711f4ee103503dd2f3e3c28eddb0a8f80 (diff) |
build: remove absolute path
Diffstat (limited to 'libdeno/test.cc')
-rw-r--r-- | libdeno/test.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libdeno/test.cc b/libdeno/test.cc index c178d109a..f48e916b9 100644 --- a/libdeno/test.cc +++ b/libdeno/test.cc @@ -5,10 +5,18 @@ deno_buf snapshot = {nullptr, 0, nullptr, 0}; int main(int argc, char** argv) { + // Locate the snapshot. + std::string exe_path; + if (!deno::ExePath(&exe_path)) { + std::cerr << "deno::ExePath() failed" << std::endl; + return 1; + } + std::string snapshot_path = deno::Dirname(exe_path) + SNAPSHOT_PATH; + // Load the snapshot. std::string contents; - if (!deno::ReadFileToString(SNAPSHOT_PATH, &contents)) { - printf("Failed to read file %s\n", SNAPSHOT_PATH); + if (!deno::ReadFileToString(snapshot_path.c_str(), &contents)) { + std::cerr << "Failed to read snapshot from " << snapshot_path << std::endl; return 1; } snapshot.data_ptr = |