1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 15:24:46 -05:00

build: remove absolute path

This commit is contained in:
Bert Belder 2018-11-01 13:05:21 +01:00
parent 9aa3640711
commit b73b651612
No known key found for this signature in database
GPG key ID: 7A77887B2E2ED461
3 changed files with 13 additions and 9 deletions

View file

@ -381,11 +381,7 @@ after_test:
Select-String $trap -Path $files -SimpleMatch | where {
# V8 took the liberty to produce an absolute path in their ninja
# output. We can't do much about that, so we just ignore it.
$_.Line -notmatch "v8/builtins-generated/bytecodes-builtins-list.h" -and
# The absolute path to snapshot_libdeno_test.bin is passed to test_cc
# via pre-processor variable. It's absolute because we want to be able
# to execute test_cc from both the project root and the build root.
$_.Line -notmatch "snapshot_libdeno_test.bin"
$_.Line -notmatch "v8/builtins-generated/bytecodes-builtins-list.h"
} | tee -Variable line_matches
if ($line_matches) {
$ctx = $line_matches.Line |

View file

@ -197,8 +197,8 @@ v8_executable("test_cc") {
data = [
"$target_gen_dir/snapshot_libdeno_test.bin",
]
snapshot_abs_path = rebase_path(data[0])
defines = [ "SNAPSHOT_PATH=\"$snapshot_abs_path\"" ]
snapshot_path = rebase_path(data[0], root_build_dir)
defines = [ "SNAPSHOT_PATH=\"$snapshot_path\"" ]
configs = [ ":deno_config" ]
}

View file

@ -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 =