diff --git a/FIGlet Text.novaextension/CHANGELOG.md b/FIGlet Text.novaextension/CHANGELOG.md index 986e7c7..4a0d20d 100644 --- a/FIGlet Text.novaextension/CHANGELOG.md +++ b/FIGlet Text.novaextension/CHANGELOG.md @@ -1,3 +1,6 @@ +## Version 1.15 +- added Apple silicon support + ## Version 1.14 - added Lua, Perl, Python, Ruby, SASS, XML, and YAML to list of supported languages for auto-commenting - fixed top/bottom border outputting too long if respective border character setting was greater than one character in length diff --git a/FIGlet Text.novaextension/Scripts/main.js b/FIGlet Text.novaextension/Scripts/main.js index a7bcd3f..76ddc73 100644 --- a/FIGlet Text.novaextension/Scripts/main.js +++ b/FIGlet Text.novaextension/Scripts/main.js @@ -1,3 +1,15 @@ +let architecture = '' +var process = new Process('/usr/bin/uname', { args: ['-m'] }); +process.onStdout((line) => { + architecture = line.trim() +}) +process.start() + +const homebrewFontDir = () => { + if (architecture === 'arm64') return '/opt/homebrew/Cellar/figlet/2.2.5/share/figlet/fonts/' + if (architecture === 'x86_64') return '/usr/local/Cellar/figlet/2.2.5/share/figlet/fonts/' +} + /** * Convert the supplied text to FIGlet format * @@ -14,9 +26,9 @@ nova.commands.register('figlet', (workspace, figletArgs, textToConvert, postConv const fontSubDir = nova.config.get('figlet_text.font', 'string').match(/^.*\/\s*/) const fontDir = () => { if (fontSubDir !== null) { - return '/usr/local/Cellar/figlet/2.2.5/share/figlet/fonts/' + fontSubDir + return homebrewFontDir() + fontSubDir } - return '/usr/local/Cellar/figlet/2.2.5/share/figlet/fonts/' + return homebrewFontDir() } let args = ['figlet'] @@ -365,7 +377,7 @@ nova.commands.register('figletTextFontPreviewAll', workspace => { // panel was canceled if (typeof inputValue === 'undefined') return - const process = new Process('/usr/bin/env', {args: ['showfigfonts', '-d', '/usr/local/Cellar/figlet/2.2.5/share/figlet/fonts/' + fontSubDir, inputValue]}) + const process = new Process('/usr/bin/env', {args: ['showfigfonts', '-d', homebrewFontDir() + fontSubDir, inputValue]}) let preview = '' process.onStdout(line => { diff --git a/FIGlet Text.novaextension/extension.json b/FIGlet Text.novaextension/extension.json index 92f766e..0510214 100644 --- a/FIGlet Text.novaextension/extension.json +++ b/FIGlet Text.novaextension/extension.json @@ -3,7 +3,7 @@ "name": "FIGlet Text", "organization": "Dan Remollino", "description": "Convert selected text to FIGlet. Great for adding readable text to the Minimap, creating l33t text headers, and organizing files.", - "version": "1.14", + "version": "1.15", "categories": ["commands", "formatters"], "entitlements": {