From 323d00669e88bf31c22c83f1e464937718ecbab3 Mon Sep 17 00:00:00 2001 From: Mike Hodnick Date: Thu, 11 Jan 2018 10:52:22 -0600 Subject: [PATCH] add configurable boot file path --- lib/repl.js | 13 +++++++++---- lib/tidalcycles.js | 4 ++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/repl.js b/lib/repl.js index 64ed386..fcda09b 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -3,7 +3,7 @@ var fs = require('fs'); var spawn = require('child_process').spawn; var Range = require('atom').range; -var bootFilePath = __dirname + "/BootTidal.hs" +var defaultBootFilePath = __dirname + "/BootTidal.hs" var CONST_LINE = 'line' var CONST_MULTI_LINE = 'multi_line' @@ -57,12 +57,17 @@ export default class REPL { } getGhciPath() { - var path = atom.config.get('tidalcycles.ghciPath'); - return path; + return atom.config.get('tidalcycles.ghciPath'); + } + + getBootTidalPath() { + return atom.config.get('tidalcycles.bootTidalPath'); } initTidal() { - var commands = fs.readFileSync(bootFilePath).toString().split('\n'); + const configuredBootFilePath = this.getBootTidalPath(); + const actualBootPath = configuredBootFilePath !== "" ? configuredBootFilePath : defaultBootFilePath; + var commands = fs.readFileSync(actualBootPath).toString().split('\n'); for (var i = 0; i < commands.length; i++) { this.tidalSendLine(commands[i]); } diff --git a/lib/tidalcycles.js b/lib/tidalcycles.js index cec2207..a70953d 100644 --- a/lib/tidalcycles.js +++ b/lib/tidalcycles.js @@ -10,6 +10,10 @@ export default { "ghciPath": { type: "string", default: "ghci" + }, + "bootTidalPath": { + type: "string", + default: "" } },