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