editors.brackets: add support for Mac OS X.

db4
John Benediktsson 2015-06-15 09:45:23 -07:00
parent 9008562265
commit 588a05bc62
3 changed files with 30 additions and 23 deletions

View File

@ -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
<PRIVATE
: windows-get-brackets-path ( -- path )
HKEY_LOCAL_MACHINE "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\Brackets.exe" KEY_READ
[ f f f registry-value-max-length TCHAR <c-array> 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

View File

@ -0,0 +1 @@
windows

View File

@ -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 <c-array>
reg-query-value-ex
] with-open-registry-key alien>native-string ;