diff --git a/lib/arduino-upload.coffee b/lib/arduino-upload.coffee index 420a541..dfb9e40 100644 --- a/lib/arduino-upload.coffee +++ b/lib/arduino-upload.coffee @@ -7,7 +7,7 @@ path = require 'path' OutputView = require './output-view' SerialView = require './serial-view' tmp = require 'tmp' -{ seperator, getArduinoPath } = require './util' +{ separator, getArduinoPath } = require './util' Boards = require './boards' try @@ -146,14 +146,14 @@ module.exports = ArduinoUpload = return options isArduinoProject: () -> editor = atom.workspace.getActivePaneItem() - file = editor?.buffer?.file?.getPath()?.split seperator + file = editor?.buffer?.file?.getPath()?.split separator file?.pop() name = file?.pop() file?.push name - workpath = file?.join seperator + workpath = file?.join separator name += '.ino' file?.push name - file = file?.join seperator + file = file?.join separator isArduino = fs.existsSync file return {isArduino, workpath, file, name} _build: (options, callback, onerror, port = false) -> @@ -221,7 +221,7 @@ module.exports = ArduinoUpload = atom.notifications.addError 'Build failed!' else if keep for ending in ['.eep', '.elf', '.hex', '.bin'] - fs.createReadStream(info.buildFolder + info.name + ending).pipe(fs.createWriteStream(info.workpath + seperator + info.name + ending)) + fs.createReadStream(info.buildFolder + separator + info.name + ending).pipe(fs.createWriteStream(info.workpath + separator + info.name + ending)) upload: -> @getPort (port) => diff --git a/lib/boards.coffee b/lib/boards.coffee index 5d11b5f..4657243 100644 --- a/lib/boards.coffee +++ b/lib/boards.coffee @@ -6,8 +6,8 @@ fs = require 'fs' readdir = Promise.promisify(fs.readdir) readFile = Promise.promisify(fs.readFile) -{ seperator, getArduinoPath } = require './util' -module.exports = +{ separator, getArduinoPath } = require './util' +module.exports = class Boards extends SelectListView inited: false loaded: false @@ -39,14 +39,14 @@ module.exports = parseNewPath: (path) -> return readdir(path).then((files) => Promise.each(files, (pkg) => - path2 = path + seperator + pkg + seperator + 'hardware' + path2 = path + separator + pkg + separator + 'hardware' readdir(path2).then((files) => Promise.each(files, (arch) => - path3 = path2 + seperator + arch + path3 = path2 + separator + arch readdir(path3).then((files) => Promise.each(files, (version) => - path4 = path3 + seperator + version - return @addBoards pkg, arch, path4 + seperator + 'boards.txt' + path4 = path3 + separator + version + return @addBoards pkg, arch, path4 + separator + 'boards.txt' ) ).catch((err) => # do nothing @@ -62,12 +62,12 @@ module.exports = parseOldPath: (path) -> return readdir(path).then((files) => Promise.each(files, (pkg) => - path2 = path + seperator + pkg + path2 = path + separator + pkg readdir(path2).then((files) => Promise.each(files, (arch) => - return @addBoards pkg, arch, path2 + seperator + arch + seperator + 'boards.txt' + return @addBoards pkg, arch, path2 + separator + arch + separator + 'boards.txt' ) - ).catch((err) => + ).catch((err) => # do nothing ) ) @@ -81,17 +81,17 @@ module.exports = # first we parse the arduino15 file structure path = '' if /^win/.test process.platform - path = process.env.LOCALAPPDATA + seperator + 'Arduino15' + path = process.env.LOCALAPPDATA + separator + 'Arduino15' else if process.platform == 'darwin' - path = process.env.HOME + seperator + 'Arduino15' + path = process.env.HOME + separator + 'Arduino15' else - path = process.env.HOME + seperator + '.arduino15' - path += seperator + 'packages' + path = process.env.HOME + separator + '.arduino15' + path += separator + 'packages' @parseNewPath(path).then( => if /^win/.test process.platform - path = getArduinoPath().split(seperator) + path = getArduinoPath().split(separator) path.pop() - path = path.join(seperator) + seperator + 'hardware' + path = path.join(separator) + separator + 'hardware' return @parseOldPath(path) ).then( => # parse the pre-arduino 1.5 boards @@ -109,8 +109,8 @@ module.exports = res.pop() res = res[res.length - 1] resolve res - ).then((path) => - path = path.strip() + seperator + 'hardware' + ).then((path) => + path = path.strip() + separator + 'hardware' @parseOldPath(path) ) ).finally( => @@ -128,7 +128,7 @@ module.exports = populateStatusBar: -> @div.innerHTML = '' @selectNode = document.createElement 'select' - + op = new Option() op.value = '' op.text = '== Arduino Setting ==' @@ -143,7 +143,7 @@ module.exports = op.text = @boards[board] @selectNode.options.add op @div.appendChild @selectNode - + cfg = atom.config.get 'arduino-upload.board' if @boards[cfg] || cfg == '' @selectNode.value = cfg diff --git a/lib/output-view.coffee b/lib/output-view.coffee index a0b46d5..8dbf18a 100644 --- a/lib/output-view.coffee +++ b/lib/output-view.coffee @@ -1,13 +1,13 @@ {View} = require 'atom-space-pen-views' -escape = (s) -> +escape = (s) -> s.replace(/&/g,'&' ).replace(/ @div class: 'arduino-upload info-view', => @button click: 'close', class: 'btn', 'close' @@ -18,7 +18,7 @@ module.exports = if tmppath && path line = line.replace /((?:\/|\n|^)[\w\-\/\.]+:)(\d)*/gi, (match) => # ok here we parse whcih filenames are clickable - + # extra holds the additional path in front, whch isn't clickable (such as the sketch path, or the tmp path) extra = '' # line holds the line number to jump to @@ -27,28 +27,28 @@ module.exports = if !match.endsWith ':' line = match.substring match.lastIndexOf(':')+1 match = match.substring 0, match.lastIndexOf(':') # we need this anyways to strip the last char - + # check if it is in the tmp directory. stripping that from the link if match.strip().startsWith tmppath extra += tmppath match = match.substring tmppath.length - # strip optional trailing seperator - if match[0] == seperator - extra += seperator + # strip optional trailing separator + if match[0] == separator + extra += separator match = match.substring 1 # make sure that we are in the sketch folder - if match.strip().substring(0, 7) == 'sketch' + seperator - extra += 'sketch' + seperator + if match.strip().substring(0, 7) == 'sketch' + separator + extra += 'sketch' + separator match = match.substring 7 - + # generate nice output file = match match += ':' if line != -1 match += line file = file.strip() - if seperator != file.substring 0,1 - file = path + seperator + file + if separator != file.substring 0,1 + file = path + separator + file if file.lastIndexOf('.')==-1 || file.lastIndexOf('.')+20 < file.length file += '.ino' extra+''+match+'' @@ -62,7 +62,7 @@ module.exports = @hide() return @find('pre').html @message - + for elem in @find('pre a') elem.addEventListener 'click', -> for pane in atom.workspace.getPanes() diff --git a/lib/util.coffee b/lib/util.coffee index 2826f9b..55bf782 100644 --- a/lib/util.coffee +++ b/lib/util.coffee @@ -1,8 +1,8 @@ -@seperator = '/' +@separator = '/' if /^win/.test process.platform - @seperator = '\\' + @separator = '\\' -@getArduinoPath = () => +@getArduinoPath = () => execPath = atom.config.get 'arduino-upload.arduinoExecutablePath' if execPath == 'arduino' # we want the default path which is actually dependent on our os