]> gitweb.factorcode.org Git - factor.git/commitdiff
webbrowser: let's change the name open-file -> open-item
authorBjörn Lindqvist <bjourne@gmail.com>
Sun, 18 Dec 2016 02:23:24 +0000 (03:23 +0100)
committerBjörn Lindqvist <bjourne@gmail.com>
Sun, 18 Dec 2016 02:23:24 +0000 (03:23 +0100)
Because the word can open more stuff than just files.

basis/tools/deploy/macosx/macosx.factor
basis/tools/deploy/unix/unix.factor
basis/tools/deploy/windows/windows.factor
basis/webbrowser/linux/linux.factor
basis/webbrowser/macosx/macosx.factor
basis/webbrowser/webbrowser-docs.factor
basis/webbrowser/webbrowser-tests.factor
basis/webbrowser/webbrowser.factor
basis/webbrowser/windows/windows.factor

index 782e09781dc7ffac94ab0747ec4cd34342168f3e..215914dcab9671f2e1fa6835afcd499a8708c829 100644 (file)
@@ -81,7 +81,7 @@ IN: tools.deploy.macosx
     bundle-name
     [ "Contents/Resources" copy-resources ]
     [ "Contents/Frameworks" copy-libraries ] 2bi
-    open-directory-after-deploy? get [ bundle-name open-file ] when ;
+    open-directory-after-deploy? get [ bundle-name open-item ] when ;
 
 : deploy-app-bundle? ( vocab -- ? )
     deploy-config [ deploy-console? get not deploy-ui? get or ] with-variables ;
index a8a37c69d1a7c58cf4525fe3a3ca3a4caa50dbe7..16676ab8b451cef92c76cc60e78155e3f7a5ff16 100644 (file)
@@ -15,7 +15,7 @@ M: unix deploy*
         [ drop deployed-image-name ]
         [ drop namespace make-deploy-image-executable ]
         [ nip "" [ copy-resources ] [ copy-libraries ] 3bi ]
-        [ nip open-directory-after-deploy? get [ open-file ] [ drop ] if ]
+        [ nip open-directory-after-deploy? get [ open-item ] [ drop ] if ]
     } 2cleave ;
 
 M: unix deploy-path
index ff0f4178547721f72b5e8566c4e53b17a5b02bfe..d4d9388f633285137d4af1dcbf6292bf2b3c0ce3 100755 (executable)
@@ -33,7 +33,7 @@ M: windows deploy*
         [ drop deployed-image-name ]
         [ drop namespace make-deploy-image-executable ]
         [ nip "" [ copy-resources ] [ copy-libraries ] 3bi ]
-        [ nip open-directory-after-deploy? get [ open-file ] [ drop ] if ]
+        [ nip open-directory-after-deploy? get [ open-item ] [ drop ] if ]
     } 2cleave ;
 
 M: windows deploy-path
index 8f3d518c4650904c3c82b7e224aa8910825ca1ed..e5ae19ec26153b59ccdb1745540b2b6348f9cb1f 100644 (file)
@@ -5,5 +5,5 @@ USING: arrays io.launcher kernel present system webbrowser ;
 
 IN: webbrowser.linux
 
-M: linux open-file ( path -- )
+M: linux open-item ( item -- )
     present "xdg-open" swap 2array run-detached drop ;
index 3b4c64214606ed220dadf10a32b3798d08560d15..9975c3ce29693e17986c8e8ac80e80fac9239b83 100644 (file)
@@ -5,5 +5,5 @@ USING: arrays io.launcher kernel present system webbrowser ;
 
 IN: webbrowser.macosx
 
-M: macosx open-file ( path -- )
+M: macosx open-item ( item -- )
     present "open" swap 2array run-detached drop ;
index d537f2806a55ffff3b8f1a010a4477478c72896a..8449502ad3756cf22e3e9265b29cb39584ea3f6e 100644 (file)
@@ -1,16 +1,14 @@
 ! Copyright (C) 2011 John Benediktsson
 ! See http://factorcode.org/license.txt for BSD license
 
-USING: help.markup help.syntax strings webbrowser ;
+USING: help.markup help.syntax kernel present strings ;
 
 IN: webbrowser
 
-HELP: open-file
-{ $values { "path" string } }
+HELP: open-item
+{ $values { "item" object } }
 { $description
-    "Open a specified file or directory in a detached process using "
-    "the default application, similar to double-clicking the file's icon."
-} ;
+  "Opens an item, which is either a file, directory or url in a detached process using the default application, similar to double-clicking the file's icon. item is any object that has the " { $link present } " method." } ;
 
 HELP: open-url
 { $values { "url" string } }
index e667e35c0ec90abb61f1f0e228877d91a5f31a0c..1bc174907fce79633fe447852772d75af284aeb2 100644 (file)
@@ -1,4 +1,4 @@
-USING: tools.test ;
+USING: io.pathnames tools.test ;
 IN: webbrowser
 
 { t } [ "http://reddit.com" url-string? ] unit-test
@@ -6,3 +6,5 @@ IN: webbrowser
 { t } [ "ftp://reddit.com" url-string? ] unit-test
 { f } [ "moo" url-string? ] unit-test
 { f } [ 123 url-string? ] unit-test
+
+{ } [ "" absolute-path open-item ] unit-test
index 2bcfccb5882a19b9a8307233e7c487c83da4fb26..a712fb1f5a2c4a810a8c7f4d6de45e1e0916ed84 100644 (file)
@@ -1,22 +1,17 @@
 ! Copyright (C) 2011 John Benediktsson
 ! See http://factorcode.org/license.txt for BSD license
-
 USING: accessors io.pathnames kernel sequences strings system
 ui.operations urls vocabs ;
-
 IN: webbrowser
 
-HOOK: open-file os ( path -- )
+HOOK: open-item os ( item -- )
 
 "webbrowser." os name>> append require
 
 : open-url ( url -- )
-    >url open-file ;
-
-[ pathname? ] \ open-file H{ } define-operation
-
-[ url? ] \ open-url H{ } define-operation
+    >url open-item ;
 
 PREDICATE: url-string < string >url protocol>> >boolean ;
 
-[ url-string? ] \ open-url H{ } define-operation
+[ pathname? ] \ open-item H{ } define-operation
+[ [ url? ] [ url-string? ] bi or ] \ open-url H{ } define-operation
index 2ec409eddd2d8c02dc0f638f15a53cf5c531abc9..705de35b9ca5a2297d3826633c3a41a05b1ee3a7 100644 (file)
@@ -4,6 +4,6 @@ USING: io.pathnames kernel present system webbrowser windows.shell32
 windows.user32 ;
 IN: webbrowser.windows
 
-M: windows open-file ( path -- )
+M: windows open-item ( item -- )
     absolute-path [ f "open" ] dip present f f
     SW_SHOWNORMAL ShellExecute drop ;