webbrowser: changing open-url to use open-file everywhere.
parent
54dcd8a4ea
commit
f98a6a7987
|
@ -1,13 +1,9 @@
|
|||
! Copyright (C) 2011 John Benediktsson
|
||||
! See http://factorcode.org/license.txt for BSD license
|
||||
|
||||
USING: formatting io.launcher present system urls webbrowser ;
|
||||
USING: io.launcher kernel sequences system webbrowser ;
|
||||
|
||||
IN: webbrowser.unix
|
||||
|
||||
M: unix open-file ( path -- )
|
||||
"gnome-open \"%s\"" sprintf try-process ;
|
||||
|
||||
M: unix open-url ( url -- )
|
||||
>url present open-file ;
|
||||
IN: webbrowser.linux
|
||||
|
||||
M: linux open-file ( path -- )
|
||||
{ "gnome-open" } swap suffix try-process ;
|
||||
|
|
|
@ -1,15 +1,9 @@
|
|||
! Copyright (C) 2011 John Benediktsson
|
||||
! See http://factorcode.org/license.txt for BSD license
|
||||
|
||||
USING: formatting io.encodings.ascii io.launcher present system
|
||||
urls webbrowser ;
|
||||
USING: io.launcher kernel sequences system webbrowser ;
|
||||
|
||||
IN: webbrowser.macosx
|
||||
|
||||
M: macosx open-file ( path -- )
|
||||
"open \"%s\"" sprintf try-process ;
|
||||
|
||||
M: macosx open-url ( url -- )
|
||||
>url present "osascript" ascii [
|
||||
"open location \"%s\"" printf
|
||||
] with-process-writer ;
|
||||
{ "open" } swap suffix try-process ;
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
! Copyright (C) 2011 John Benediktsson
|
||||
! See http://factorcode.org/license.txt for BSD license
|
||||
|
||||
USING: combinators system ui.operations urls vocabs ;
|
||||
USING: combinators present system ui.operations urls vocabs ;
|
||||
|
||||
IN: webbrowser
|
||||
|
||||
HOOK: open-file os ( path -- )
|
||||
|
||||
HOOK: open-url os ( url -- )
|
||||
|
||||
{
|
||||
{ [ os macosx? ] [ "webbrowser.macosx" ] }
|
||||
{ [ os linux? ] [ "webbrowser.linux" ] }
|
||||
{ [ os windows? ] [ "webbrowser.windows" ] }
|
||||
} cond require
|
||||
|
||||
: open-url ( url -- )
|
||||
>url present open-file ;
|
||||
|
||||
[ url? ] \ open-url H{ } define-operation
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
! Copyright (C) 2011 John Benediktsson
|
||||
! See http://factorcode.org/license.txt for BSD license
|
||||
|
||||
USING: present urls webbrowser windows.shell32 windows.user32 ;
|
||||
USING: webbrowser windows.shell32 windows.user32 ;
|
||||
|
||||
IN: webbrowser.windows
|
||||
|
||||
M: windows open-file ( path -- )
|
||||
[ f "open" ] dip f f SW_SHOWNORMAL ShellExecute drop ;
|
||||
|
||||
M: windows open-url ( url -- )
|
||||
>url present open-file ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue