diff --git a/.gitignore b/.gitignore index 9a0a6e6..c0fe2ee 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ build frames -.DS_Store \ No newline at end of file +.DS_Store +.vscode \ No newline at end of file diff --git a/2015/01/part1.py b/2015/01/part1.py index b5387c7..8144159 100644 --- a/2015/01/part1.py +++ b/2015/01/part1.py @@ -1,4 +1,7 @@ -with open('input.txt', 'r') as input: +import os +path = os.path.dirname(os.path.abspath(__file__)) + +with open(path+'/input.txt', 'r') as input: counter = 0 text = input.readline() for char in text : diff --git a/2015/01/part2.py b/2015/01/part2.py index 784c2ce..55af729 100644 --- a/2015/01/part2.py +++ b/2015/01/part2.py @@ -1,4 +1,7 @@ -with open('input.txt', 'r') as input: +import os +path = os.path.dirname(os.path.abspath(__file__)) + +with open(path+'/input.txt', 'r') as input: pos = 0 char_pos = 0 text = input.readline() diff --git a/2015/03/part1.py b/2015/03/part1.py index 4dac7f5..8a873f1 100644 --- a/2015/03/part1.py +++ b/2015/03/part1.py @@ -1,4 +1,7 @@ -with open("input.txt", "r") as commands: +import os +path = os.path.dirname(os.path.abspath(__file__)) + +with open(path+"/input.txt", "r") as commands: x = 0 y = 0 history = [] diff --git a/2018/04/part1.js b/2018/04/part1.js index 72012cf..ca4c352 100644 --- a/2018/04/part1.js +++ b/2018/04/part1.js @@ -1,6 +1,6 @@ const fs = require('fs'); -let input = fs.readFileSync('input.txt', 'utf-8').split('\n').sort((a, b) => val(a).getTime() - val(b).getTime()); +let input = fs.readFileSync(`${__dirname}/input.txt`, 'utf-8').split('\n').sort((a, b) => val(a).getTime() - val(b).getTime()); function val(a) { let time = new Date(a.match(/\[(.*)\]/)[1]);