From 7f93d335a656611cc656ebe6fd8bf576a82453f3 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 8 Dec 2008 20:10:52 -0600 Subject: [PATCH 1/2] fix bug in io.paths, add io.paths.windows --- extra/io/paths/paths.factor | 23 ++++++++++++++++------- extra/io/paths/windows/authors.txt | 1 + extra/io/paths/windows/tags.txt | 1 + extra/io/paths/windows/windows.factor | 13 +++++++++++++ 4 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 extra/io/paths/windows/authors.txt create mode 100644 extra/io/paths/windows/tags.txt create mode 100644 extra/io/paths/windows/windows.factor diff --git a/extra/io/paths/paths.factor b/extra/io/paths/paths.factor index 8237e59a1b..75d08b60f8 100755 --- a/extra/io/paths/paths.factor +++ b/extra/io/paths/paths.factor @@ -1,11 +1,13 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: io.files kernel sequences accessors -dlists deques arrays ; +USING: accessors arrays deques dlists io.files io.paths.private +kernel sequences system vocabs.loader fry continuations ; IN: io.paths TUPLE: directory-iterator path bfs queue ; + + +: find-file ( path bfs? quot: ( obj -- ? ) -- path/f ) [ ] dip [ keep and ] curry iterate-directory ; inline -: each-file ( path bfs? quot -- ) +: each-file ( path bfs? quot: ( obj -- ? ) -- ) [ ] dip [ f ] compose iterate-directory drop ; inline -: find-all-files ( path bfs? quot -- paths ) +: find-all-files ( path bfs? quot: ( obj -- ? ) -- paths ) [ ] dip pusher [ [ f ] compose iterate-directory drop ] dip ; inline : recursive-directory ( path bfs? -- paths ) [ ] accumulator [ each-file ] dip ; + +: find-in-directories ( directories bfs? quot -- path' ) + '[ _ _ find-file ] attempt-all ; inline + +os windows? [ "io.paths.windows" require ] when diff --git a/extra/io/paths/windows/authors.txt b/extra/io/paths/windows/authors.txt new file mode 100644 index 0000000000..7c1b2f2279 --- /dev/null +++ b/extra/io/paths/windows/authors.txt @@ -0,0 +1 @@ +Doug Coleman diff --git a/extra/io/paths/windows/tags.txt b/extra/io/paths/windows/tags.txt new file mode 100644 index 0000000000..6bf68304bb --- /dev/null +++ b/extra/io/paths/windows/tags.txt @@ -0,0 +1 @@ +unportable diff --git a/extra/io/paths/windows/windows.factor b/extra/io/paths/windows/windows.factor new file mode 100644 index 0000000000..b4858aaef8 --- /dev/null +++ b/extra/io/paths/windows/windows.factor @@ -0,0 +1,13 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: arrays continuations fry io.files io.paths +kernel windows.shell32 sequences ; +IN: io.paths.windows + +: program-files-directories ( -- array ) + program-files program-files-x86 2array ; inline + +: find-in-program-files ( base-directory bfs? quot -- path ) + [ + [ program-files-directories ] dip '[ _ append-path ] map + ] 2dip find-in-directories ; inline From 44e582bbebe92c194a74f0b761c4e3432a20d473 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 8 Dec 2008 20:11:24 -0600 Subject: [PATCH 2/2] update all editors for windows 64 to look in "program files" and "program files (x86)" --- basis/editors/editpadlite/authors.txt | 2 ++ .../editpadlite/editpadlite-docs.factor | 7 ++++ basis/editors/editpadlite/editpadlite.factor | 16 +++++++++ basis/editors/editpadlite/summary.txt | 1 + basis/editors/editpadlite/tags.txt | 1 + .../editors/editpadpro/editpadpro-docs.factor | 7 ++-- basis/editors/editpadpro/editpadpro.factor | 9 +++-- basis/editors/editplus/editplus.factor | 4 +-- basis/editors/emeditor/emeditor.factor | 7 ++-- basis/editors/etexteditor/etexteditor.factor | 4 +-- basis/editors/gvim/windows/windows.factor | 5 ++- basis/editors/notepad2/notepad2.factor | 8 ++--- basis/editors/notepadpp/notepadpp.factor | 6 ++-- basis/editors/scite/scite.factor | 35 +++++++------------ basis/editors/scite/summary.txt | 2 +- basis/editors/ted-notepad/ted-notepad.factor | 9 ++--- basis/editors/textedit/textedit.factor | 3 -- basis/editors/ultraedit/ultraedit.factor | 5 ++- basis/editors/wordpad/wordpad.factor | 10 +++--- 19 files changed, 77 insertions(+), 64 deletions(-) create mode 100644 basis/editors/editpadlite/authors.txt create mode 100644 basis/editors/editpadlite/editpadlite-docs.factor create mode 100644 basis/editors/editpadlite/editpadlite.factor create mode 100644 basis/editors/editpadlite/summary.txt create mode 100644 basis/editors/editpadlite/tags.txt diff --git a/basis/editors/editpadlite/authors.txt b/basis/editors/editpadlite/authors.txt new file mode 100644 index 0000000000..aa43d6ea12 --- /dev/null +++ b/basis/editors/editpadlite/authors.txt @@ -0,0 +1,2 @@ +Ryan Murphy +Doug Coleman diff --git a/basis/editors/editpadlite/editpadlite-docs.factor b/basis/editors/editpadlite/editpadlite-docs.factor new file mode 100644 index 0000000000..4f0c8f800d --- /dev/null +++ b/basis/editors/editpadlite/editpadlite-docs.factor @@ -0,0 +1,7 @@ +USING: help.syntax help.markup ; +IN: editors.editpadpro + +ARTICLE: "editors.editpadpro" "EditPad Pro support" +"EditPadPro text editor integration on Windows. Be sure to put EditPadPro in your system path so that it will be found. Windows only." ; + +ABOUT: "editors.editpadpro" diff --git a/basis/editors/editpadlite/editpadlite.factor b/basis/editors/editpadlite/editpadlite.factor new file mode 100644 index 0000000000..c002c2fa75 --- /dev/null +++ b/basis/editors/editpadlite/editpadlite.factor @@ -0,0 +1,16 @@ +USING: definitions kernel parser words sequences math.parser +namespaces editors io.launcher windows.shell32 io.files +io.paths.windows strings unicode.case make ; +IN: editors.editpadlite + +: editpadlite-path ( -- path ) + \ editpadlite-path get-global [ + "JGsoft" t [ >lower "editpadlite.exe" tail? ] find-in-program-files + ] unless* ; + +: editpadlite ( file line -- ) + [ + editpadlite-path , drop , + ] { } make run-detached drop ; + +[ editpadlite ] edit-hook set-global diff --git a/basis/editors/editpadlite/summary.txt b/basis/editors/editpadlite/summary.txt new file mode 100644 index 0000000000..445e15f75d --- /dev/null +++ b/basis/editors/editpadlite/summary.txt @@ -0,0 +1 @@ +EditPadLite editor integration diff --git a/basis/editors/editpadlite/tags.txt b/basis/editors/editpadlite/tags.txt new file mode 100644 index 0000000000..6bf68304bb --- /dev/null +++ b/basis/editors/editpadlite/tags.txt @@ -0,0 +1 @@ +unportable diff --git a/basis/editors/editpadpro/editpadpro-docs.factor b/basis/editors/editpadpro/editpadpro-docs.factor index f3484917cb..4f0c8f800d 100644 --- a/basis/editors/editpadpro/editpadpro-docs.factor +++ b/basis/editors/editpadpro/editpadpro-docs.factor @@ -1,6 +1,7 @@ USING: help.syntax help.markup ; +IN: editors.editpadpro -ARTICLE: "editpadpro" "EditPad Pro support" -"Just load this module and you will be able to edit documentation with EditPadPro. Be sure to put EditPadPro in your system path so that it will be found. Windows only." ; +ARTICLE: "editors.editpadpro" "EditPad Pro support" +"EditPadPro text editor integration on Windows. Be sure to put EditPadPro in your system path so that it will be found. Windows only." ; -ABOUT: "editpadpro" \ No newline at end of file +ABOUT: "editors.editpadpro" diff --git a/basis/editors/editpadpro/editpadpro.factor b/basis/editors/editpadpro/editpadpro.factor index 09f59f0916..2a7f92f932 100644 --- a/basis/editors/editpadpro/editpadpro.factor +++ b/basis/editors/editpadpro/editpadpro.factor @@ -1,17 +1,16 @@ USING: definitions kernel parser words sequences math.parser namespaces editors io.launcher windows.shell32 io.files -io.paths strings unicode.case make ; +io.paths.windows strings unicode.case make ; IN: editors.editpadpro -: editpadpro-path +: editpadpro-path ( -- path ) \ editpadpro-path get-global [ - program-files "JGsoft" append-path - t [ >lower "editpadpro.exe" tail? ] find-file + "JGsoft" t [ >lower "editpadpro.exe" tail? ] find-in-program-files ] unless* ; : editpadpro ( file line -- ) [ - editpadpro-path , "/l" swap number>string append , , + editpadpro-path , number>string "/l" prepend , , ] { } make run-detached drop ; [ editpadpro ] edit-hook set-global diff --git a/basis/editors/editplus/editplus.factor b/basis/editors/editplus/editplus.factor index 8af036f290..9fa477f51a 100644 --- a/basis/editors/editplus/editplus.factor +++ b/basis/editors/editplus/editplus.factor @@ -1,10 +1,10 @@ USING: editors io.files io.launcher kernel math.parser -namespaces sequences windows.shell32 make ; +namespaces sequences windows.shell32 make io.paths.windows ; IN: editors.editplus : editplus-path ( -- path ) \ editplus-path get-global [ - program-files "\\EditPlus 2\\editplus.exe" append-path + "EditPlus 2" t [ "editplus.exe" tail? ] find-in-program-files ] unless* ; : editplus ( file line -- ) diff --git a/basis/editors/emeditor/emeditor.factor b/basis/editors/emeditor/emeditor.factor index 9aec22eed1..fc3deae670 100644 --- a/basis/editors/emeditor/emeditor.factor +++ b/basis/editors/emeditor/emeditor.factor @@ -1,11 +1,10 @@ -USING: editors hardware-info.windows io.files io.launcher -kernel math.parser namespaces sequences windows.shell32 -make ; +USING: editors io.files io.launcher kernel math.parser +namespaces sequences windows.shell32 make io.paths.windows ; IN: editors.emeditor : emeditor-path ( -- path ) \ emeditor-path get-global [ - program-files "\\EmEditor\\EmEditor.exe" append-path + "EmEditor" t [ "EmEditor.exe" tail? ] find-in-program-files ] unless* ; : emeditor ( file line -- ) diff --git a/basis/editors/etexteditor/etexteditor.factor b/basis/editors/etexteditor/etexteditor.factor index 316bd24cfa..c4b3ad35c1 100755 --- a/basis/editors/etexteditor/etexteditor.factor +++ b/basis/editors/etexteditor/etexteditor.factor @@ -1,12 +1,12 @@ ! Copyright (C) 2008 Kibleur Christophe. ! See http://factorcode.org/license.txt for BSD license. USING: editors io.files io.launcher kernel math.parser -namespaces sequences windows.shell32 make ; +namespaces sequences windows.shell32 io.paths.windows make ; IN: editors.etexteditor : etexteditor-path ( -- str ) \ etexteditor-path get-global [ - program-files "e\\e.exe" append-path + "e" t [ "e.exe" tail? ] find-in-program-files ] unless* ; : etexteditor ( file line -- ) diff --git a/basis/editors/gvim/windows/windows.factor b/basis/editors/gvim/windows/windows.factor index 8c4e1aaacb..2f733f3c2f 100644 --- a/basis/editors/gvim/windows/windows.factor +++ b/basis/editors/gvim/windows/windows.factor @@ -1,9 +1,8 @@ USING: editors.gvim io.files io.windows kernel namespaces -sequences windows.shell32 io.paths system ; +sequences windows.shell32 io.paths.windows system ; IN: editors.gvim.windows M: windows gvim-path \ gvim-path get-global [ - program-files "vim" append-path - t [ "gvim.exe" tail? ] find-file + "vim" t [ "gvim.exe" tail? ] find-in-program-files ] unless* ; diff --git a/basis/editors/notepad2/notepad2.factor b/basis/editors/notepad2/notepad2.factor index 4d333e45dd..e22de4f68d 100644 --- a/basis/editors/notepad2/notepad2.factor +++ b/basis/editors/notepad2/notepad2.factor @@ -2,10 +2,10 @@ USING: editors io.files io.launcher kernel math.parser namespaces sequences windows.shell32 make ; IN: editors.notepad2 -: notepad2-path ( -- str ) +: notepad2-path ( -- path ) \ notepad2-path get-global [ - program-files "C:\\Windows\\system32\\notepad.exe" append-path - ] unless* ; + "C:\\Windows\\system32\\notepad.exe" + ] unless* ; : notepad2 ( file line -- ) [ @@ -13,4 +13,4 @@ IN: editors.notepad2 "/g" , number>string , , ] { } make run-detached drop ; -[ notepad2 ] edit-hook set-global \ No newline at end of file +[ notepad2 ] edit-hook set-global diff --git a/basis/editors/notepadpp/notepadpp.factor b/basis/editors/notepadpp/notepadpp.factor index 540612aeec..d68008c2ca 100644 --- a/basis/editors/notepadpp/notepadpp.factor +++ b/basis/editors/notepadpp/notepadpp.factor @@ -1,10 +1,10 @@ USING: editors io.files io.launcher kernel math.parser -namespaces sequences windows.shell32 make ; +namespaces sequences io.paths.windows make ; IN: editors.notepadpp -: notepadpp-path +: notepadpp-path ( -- path ) \ notepadpp-path get-global [ - program-files "notepad++\\notepad++.exe" append-path + "notepad++" t [ "notepad++.exe" tail? ] find-in-program-files ] unless* ; : notepadpp ( file line -- ) diff --git a/basis/editors/scite/scite.factor b/basis/editors/scite/scite.factor index 10152f53d5..e0b48a3e72 100644 --- a/basis/editors/scite/scite.factor +++ b/basis/editors/scite/scite.factor @@ -1,34 +1,25 @@ -! Basic SciTE integration for Factor. -! -! By Clemens F. Hofreither, 2007. +! Copyright (C) 2007 Clemens F. Hofreither. +! See http://factorcode.org/license.txt for BSD license. ! clemens.hofreither@gmx.net -! -! In your .factor-rc or .factor-boot-rc, -! require this module and set the scite-path -! variable to point to your executable, -! if not on the path. -! -USING: io.files io.launcher kernel namespaces math -math.parser editors sequences windows.shell32 make ; +USING: io.files io.launcher kernel namespaces io.paths.windows +math math.parser editors sequences make unicode.case ; IN: editors.scite : scite-path ( -- path ) \ scite-path get-global [ - program-files "ScITE Source Code Editor\\SciTE.exe" append-path - dup exists? [ - drop program-files "wscite\\SciTE.exe" append-path - ] unless + "Scintilla Text Editor" t + [ >lower "scite.exe" tail? ] find-in-program-files ] unless* ; : scite-command ( file line -- cmd ) - swap - [ - scite-path , - , - "-goto:" swap number>string append , - ] { } make ; + swap + [ + scite-path , + , + number>string "-goto:" prepend , + ] { } make ; : scite-location ( file line -- ) - scite-command run-detached drop ; + scite-command run-detached drop ; [ scite-location ] edit-hook set-global diff --git a/basis/editors/scite/summary.txt b/basis/editors/scite/summary.txt index 1088ee7f5a..c5f9bb9a09 100644 --- a/basis/editors/scite/summary.txt +++ b/basis/editors/scite/summary.txt @@ -1 +1 @@ -SciTE editor integration +Scintilla text editor (SciTE) integration diff --git a/basis/editors/ted-notepad/ted-notepad.factor b/basis/editors/ted-notepad/ted-notepad.factor index b4135c92a0..994dc60ba3 100644 --- a/basis/editors/ted-notepad/ted-notepad.factor +++ b/basis/editors/ted-notepad/ted-notepad.factor @@ -1,15 +1,16 @@ USING: editors io.files io.launcher kernel math.parser -namespaces sequences windows.shell32 make ; +namespaces sequences io.paths.windows make ; IN: editors.ted-notepad -: ted-notepad-path +: ted-notepad-path ( -- path ) \ ted-notepad-path get-global [ - program-files "\\TED Notepad\\TedNPad.exe" append-path + "TED Notepad" t [ "TedNPad.exe" tail? ] find-in-program-files ] unless* ; : ted-notepad ( file line -- ) [ - ted-notepad-path , "/l" swap number>string append , , + ted-notepad-path , + number>string "/l" prepend , , ] { } make run-detached drop ; [ ted-notepad ] edit-hook set-global diff --git a/basis/editors/textedit/textedit.factor b/basis/editors/textedit/textedit.factor index 6942e24534..cccc94b539 100644 --- a/basis/editors/textedit/textedit.factor +++ b/basis/editors/textedit/textedit.factor @@ -1,6 +1,5 @@ USING: definitions io.launcher kernel math math.parser parser namespaces prettyprint editors make ; - IN: editors.textedit : textedit-location ( file line -- ) @@ -9,5 +8,3 @@ IN: editors.textedit try-process ; [ textedit-location ] edit-hook set-global - - diff --git a/basis/editors/ultraedit/ultraedit.factor b/basis/editors/ultraedit/ultraedit.factor index 7c9c41df7a..f1929ebf64 100644 --- a/basis/editors/ultraedit/ultraedit.factor +++ b/basis/editors/ultraedit/ultraedit.factor @@ -1,11 +1,10 @@ USING: editors io.files io.launcher kernel math.parser -namespaces sequences windows.shell32 wne ; +namespaces sequences io.paths.windows make ; IN: editors.ultraedit : ultraedit-path ( -- path ) \ ultraedit-path get-global [ - program-files - "IDM Computer Solutions\\UltraEdit-32\\uedit32.exe" append-path + "IDM Computer Solutions" t [ "uedit32.exe" tail? ] find-in-program-files ] unless* ; : ultraedit ( file line -- ) diff --git a/basis/editors/wordpad/wordpad.factor b/basis/editors/wordpad/wordpad.factor index 3f3dd6cab1..fa0f6852dd 100644 --- a/basis/editors/wordpad/wordpad.factor +++ b/basis/editors/wordpad/wordpad.factor @@ -1,14 +1,14 @@ -USING: editors hardware-info.windows io.launcher kernel -math.parser namespaces sequences windows.shell32 io.files -arrays ; +USING: editors io.launcher kernel io.paths.windows +math.parser namespaces sequences io.files arrays ; IN: editors.wordpad : wordpad-path ( -- path ) \ wordpad-path get [ - program-files "Windows NT\\Accessories\\wordpad.exe" append-path + "Windows NT\\Accessories" t + [ "wordpad.exe" tail? ] find-in-program-files ] unless* ; : wordpad ( file line -- ) - drop wordpad-path swap 2array dup . run-detached drop ; + drop wordpad-path swap 2array run-detached drop ; [ wordpad ] edit-hook set-global