diff --git a/basis/editors/brackets/brackets.factor b/basis/editors/brackets/brackets.factor index 3a25bfada9..6b1f2c0255 100644 --- a/basis/editors/brackets/brackets.factor +++ b/basis/editors/brackets/brackets.factor @@ -1,33 +1,22 @@ ! Copyright (C) 2015 Dimage Sapelkin. ! See http://factorcode.org/license.txt for BSD license. -USING: editors kernel make math.parser namespaces sequences quotations system alien.data alien.strings - windows.advapi32 windows.registry windows.types windows.errors windows.registry.private combinators ; +USING: editors io.pathnames io.standard-paths kernel make +namespaces system vocabs ; IN: editors.brackets SINGLETON: brackets-editor -brackets-editor \ editor-class set-global +brackets-editor editor-class set-global -! SYMBOL: brackets-path +HOOK: brackets-path os ( -- path ) -! HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Brackets.exe - - reg-query-value-ex ] with-open-registry-key - alien>native-string -; - -PRIVATE> +M: macosx brackets-path + "io.brackets.appshell" find-native-bundle [ + "Contents/MacOS/Brackets" append-path + ] [ + f + ] if* ; M: brackets-editor editor-command ( file line -- command ) - [ os { - { [ dup windows? ] ! only windows implemented so far, though Brackets is a cross-platform app - [ drop windows-get-brackets-path ] } - { [ t ] [ drop "brackets" ] } - } cond - , - drop , - ] { } make ; + [ brackets-path "brackets" or , drop , ] { } make ; +os windows? [ "editors.brackets.windows" require ] when diff --git a/basis/editors/brackets/windows/platforms.txt b/basis/editors/brackets/windows/platforms.txt new file mode 100644 index 0000000000..8e1a55995e --- /dev/null +++ b/basis/editors/brackets/windows/platforms.txt @@ -0,0 +1 @@ +windows diff --git a/basis/editors/brackets/windows/windows.factor b/basis/editors/brackets/windows/windows.factor new file mode 100644 index 0000000000..39194e3a90 --- /dev/null +++ b/basis/editors/brackets/windows/windows.factor @@ -0,0 +1,17 @@ +! Copyright (C) 2015 Dimage Sapelkin. +! See http://factorcode.org/license.txt for BSD license. +USING: alien.data alien.strings combinators editors kernel make +math.parser namespaces quotations sequences system +windows.advapi32 windows.registry windows.registry.private +windows.types windows.errors ; + +IN: editors.brackets.windows + +M: windows brackets-path + HKEY_LOCAL_MACHINE + "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\Brackets.exe" + KEY_READ [ + f f f + registry-value-max-length TCHAR + reg-query-value-ex + ] with-open-registry-key alien>native-string ;