From d153054abb6a52b190ef3493f4951450bc59b252 Mon Sep 17 00:00:00 2001 From: Jan <26145882+imverum@users.noreply.github.com> Date: Sat, 5 Dec 2020 11:35:52 +0100 Subject: [PATCH] Fixed input loading thing --- day_1/task_1.js | 2 +- day_1/task_2.js | 2 +- day_2/task_1.js | 2 +- day_2/task_2.js | 2 +- day_3/task_1.js | 2 +- day_3/task_2.js | 2 +- day_4/task_1.js | 2 +- day_4/task_2.js | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/day_1/task_1.js b/day_1/task_1.js index 65a6a49..4839b3f 100644 --- a/day_1/task_1.js +++ b/day_1/task_1.js @@ -1,5 +1,5 @@ const fs = require('fs'); -const file = fs.readFileSync('./input.txt').toString('utf-8'); +const file = fs.readFileSync(__dirname + '/input.txt').toString('utf-8'); const arr = file.split('\n'); arr.forEach(num => { diff --git a/day_1/task_2.js b/day_1/task_2.js index 6904256..044afdc 100644 --- a/day_1/task_2.js +++ b/day_1/task_2.js @@ -1,5 +1,5 @@ const fs = require('fs'); -const file = fs.readFileSync('./input.txt').toString('utf-8'); +const file = fs.readFileSync(__dirname + '/input.txt').toString('utf-8'); const arr = file.split('\n'); arr.forEach(num => { diff --git a/day_2/task_1.js b/day_2/task_1.js index 7cc5298..5675dcc 100644 --- a/day_2/task_1.js +++ b/day_2/task_1.js @@ -1,5 +1,5 @@ const fs = require('fs'); -const file = fs.readFileSync('./input.txt').toString('utf-8'); +const file = fs.readFileSync(__dirname + '/input.txt').toString('utf-8'); const arr = file.split('\n'); let invalid = [] diff --git a/day_2/task_2.js b/day_2/task_2.js index c0bc688..df4fbf0 100644 --- a/day_2/task_2.js +++ b/day_2/task_2.js @@ -1,5 +1,5 @@ const fs = require('fs'); -const file = fs.readFileSync('./input.txt').toString('utf-8'); +const file = fs.readFileSync(__dirname + '/input.txt').toString('utf-8'); const arr = file.split('\n'); let invalid = [] diff --git a/day_3/task_1.js b/day_3/task_1.js index 227c40d..f85c24e 100644 --- a/day_3/task_1.js +++ b/day_3/task_1.js @@ -1,5 +1,5 @@ const fs = require('fs'); -const file = fs.readFileSync('./input.txt').toString('utf-8'); +const file = fs.readFileSync(__dirname + '/input.txt').toString('utf-8'); const arr = file.split('\n'); let trees = 0; diff --git a/day_3/task_2.js b/day_3/task_2.js index 1885395..c3e652d 100644 --- a/day_3/task_2.js +++ b/day_3/task_2.js @@ -1,5 +1,5 @@ const fs = require('fs'); -const file = fs.readFileSync('./input.txt').toString('utf-8'); +const file = fs.readFileSync(__dirname + '/input.txt').toString('utf-8'); const arr = file.split('\n'); const speeds = [ diff --git a/day_4/task_1.js b/day_4/task_1.js index 370f953..8c88db1 100644 --- a/day_4/task_1.js +++ b/day_4/task_1.js @@ -1,5 +1,5 @@ const fs = require('fs'); -const file = fs.readFileSync('./input.txt').toString('utf-8'); +const file = fs.readFileSync(__dirname + '/input.txt').toString('utf-8'); const passports = file.split('\n\n'); const fieldNames = { diff --git a/day_4/task_2.js b/day_4/task_2.js index 8f3d841..34d7081 100644 --- a/day_4/task_2.js +++ b/day_4/task_2.js @@ -1,5 +1,5 @@ const fs = require('fs'); -const file = fs.readFileSync('./input.txt').toString('utf-8'); +const file = fs.readFileSync(__dirname + '/input.txt').toString('utf-8'); const passports = file.split('\n\n'); const fieldNames = {