]> gitweb.factorcode.org Git - factor.git/commitdiff
webbrowser: adding open-file support for pathnames.
authorJohn Benediktsson <mrjbq7@gmail.com>
Sun, 17 Nov 2013 20:57:11 +0000 (12:57 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sun, 17 Nov 2013 20:57:11 +0000 (12:57 -0800)
basis/webbrowser/linux/linux.factor
basis/webbrowser/macosx/macosx.factor
basis/webbrowser/webbrowser.factor
basis/webbrowser/windows/windows.factor

index 70a0ee976223f26d083b163e6fd6a1549d6e50be..322ea1943807fc7a139b94af32a255a939f6a3d8 100644 (file)
@@ -1,9 +1,9 @@
 ! Copyright (C) 2011 John Benediktsson
 ! See http://factorcode.org/license.txt for BSD license
 
-USING: io.launcher kernel sequences system webbrowser ;
+USING: arrays io.launcher kernel present system webbrowser ;
 
 IN: webbrowser.linux
 
 M: linux open-file ( path -- )
-    { "xdg-open" } swap suffix try-process ;
+    present "xdg-open" swap 2array try-process ;
index 18157df881374e5fc9af967da93a4c32912b839c..7f9a22fc6bc49ae718a1518cd2ef5962b93c92dc 100644 (file)
@@ -1,9 +1,9 @@
 ! Copyright (C) 2011 John Benediktsson
 ! See http://factorcode.org/license.txt for BSD license
 
-USING: io.launcher kernel sequences system webbrowser ;
+USING: arrays io.launcher kernel present system webbrowser ;
 
 IN: webbrowser.macosx
 
 M: macosx open-file ( path -- )
-    { "open" } swap suffix try-process ;
+    present "open" swap 2array try-process ;
index abad160f2ddaf15fe2c7ccbb420d2b8b3635dcdc..232d28fda6baeefbe64118100eccbe2d01443d22 100644 (file)
@@ -1,8 +1,8 @@
 ! Copyright (C) 2011 John Benediktsson
 ! See http://factorcode.org/license.txt for BSD license
 
-USING: combinators combinators.short-circuit present sequences strings system
-ui.operations urls vocabs ;
+USING: combinators combinators.short-circuit io.pathnames
+present sequences strings system ui.operations urls vocabs ;
 
 IN: webbrowser
 
@@ -15,7 +15,9 @@ HOOK: open-file os ( path -- )
 } cond require
 
 : open-url ( url -- )
-    >url present open-file ;
+    >url open-file ;
+
+[ pathname? ] \ open-file H{ } define-operation
 
 [ url? ] \ open-url H{ } define-operation
 
index 1f7448b5aadb8dd07551857fa580130acab23dce..ab88c3e5ceff973e196b7fe24d46a1b8d3a83016 100644 (file)
@@ -1,9 +1,11 @@
 ! Copyright (C) 2011 John Benediktsson
 ! See http://factorcode.org/license.txt for BSD license
 
-USING: system kernel webbrowser windows.shell32 windows.user32 ;
+USING: kernel present system webbrowser windows.shell32
+windows.user32 ;
 
 IN: webbrowser.windows
 
 M: windows open-file ( path -- )
-    [ f "open" ] dip f f SW_SHOWNORMAL ShellExecute drop ;
+    [ f "open" ] dip present f f
+    SW_SHOWNORMAL ShellExecute drop ;