]> gitweb.factorcode.org Git - factor.git/commitdiff
io.directories: Add with-resource-directory word and use it.
authorDoug Coleman <doug.coleman@gmail.com>
Tue, 24 Sep 2013 20:13:39 +0000 (13:13 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Tue, 24 Sep 2013 20:13:39 +0000 (13:13 -0700)
basis/io/directories/directories.factor
basis/tools/deploy/macosx/macosx.factor
basis/tools/deploy/test/test.factor
basis/tools/deploy/unix/unix.factor
basis/tools/deploy/windows/windows.factor
extra/mason/release/tidy/tidy-tests.factor
extra/webapps/calculator/calculator.factor

index eb656be6b4f5f5656da670318cad48ac485f18cd..91401515f53cfa2a12ec70e00bb5184206fe0844 100644 (file)
@@ -11,6 +11,9 @@ IN: io.directories
 : with-directory ( path quot -- )
     [ absolute-path current-directory ] dip with-variable ; inline
 
+: with-resource-directory ( quot -- )
+    [ "resource:" ] dip with-directory ; inline
+
 ! Creating directories
 HOOK: make-directory io-backend ( path -- )
 
index ab35070ac6741930e9c4a600f1eea68f6c088927..6b06dd0c08d054fb2fc29b4b92817d8db1870c10 100644 (file)
@@ -74,7 +74,7 @@ IN: tools.deploy.macosx
     [ % "/Contents/Resources/" % % ".image" % ] "" make ;
 
 : deploy-app-bundle ( vocab -- )
-    "resource:" [
+    [
         dup deploy-config [
             bundle-name dup exists? [ delete-tree ] [ drop ] if
             [ bundle-name create-app-dir ] keep
@@ -85,7 +85,7 @@ IN: tools.deploy.macosx
             [ "Contents/Frameworks" copy-libraries ] 2bi
             bundle-name show-in-finder
         ] with-variables
-    ] with-directory ;
+    ] with-resource-directory ;
 
 : deploy-app-bundle? ( vocab -- ? )
     deploy-config [ deploy-console? get not deploy-ui? get or ] with-variables ;
index b04abe7d7e9e285dd7ce33c5a338a6d1e02ffcde..db016f15c34f925eb6e85d95983749ec882eae70 100644 (file)
@@ -9,10 +9,10 @@ IN: tools.deploy.test
 
 : shake-and-bake ( vocab -- )
     [ test-image temp-file delete-file ] ignore-errors
-    "resource:" [
+    [
         [ vm test-image temp-file ] dip
         dup deploy-config make-deploy-image drop
-    ] with-directory ;
+    ] with-resource-directory ;
 
 ERROR: image-too-big actual-size max-size ;
 
index 0b4b58ee666541a6a4e9fe552eae96ba8b96ab2f..7b3ffb05a013eb96b6fab698e8221e6cd8cf85d1 100644 (file)
@@ -14,7 +14,7 @@ IN: tools.deploy.unix
     deploy-name get ;
 
 M: unix deploy* ( vocab -- )
-    "resource:" [
+    [
         dup deploy-config [
             [ bundle-name create-app-dir ] keep
             [ deployed-image-name ] keep
@@ -23,4 +23,4 @@ M: unix deploy* ( vocab -- )
             bundle-name normalize-path "Binary deployed to " "." surround print
             bundle-name webbrowser:open-file
         ] with-variables
-    ] with-directory ;
+    ] with-resource-directory ;
index 8de593c1fb1f3183a77068be2dcca03f235d0db9..31b7f9fde214130ef33b90a8e7963b54f3c847bb 100755 (executable)
@@ -29,7 +29,7 @@ CONSTANT: app-icon-resource-id "APPICON"
     [ 2drop ] if ;
 
 M: windows deploy*
-    "resource:" [
+    [
         dup deploy-config [
             deploy-name get
             {
@@ -41,4 +41,4 @@ M: windows deploy*
                 [ nip open-in-explorer ]
             } 2cleave 
         ] with-variables
-    ] with-directory ;
+    ] with-resource-directory ;
index 01475f026b112e6ad77fb8ef33e8ead55d72a1a4..76d0e0ed196332616aa6d8f0366299abd7639469 100644 (file)
@@ -6,7 +6,7 @@ IN: mason.release.tidy.tests
 ! of the build directory, and they look for a file named
 ! build-support/cleanup there. Use with-directory here to
 ! ensure we use the file from the current source tree instead.
-"resource:" [
+[
     [ f ] [
         macosx target-os [
             "Factor.app" useless-files member?
@@ -18,4 +18,4 @@ IN: mason.release.tidy.tests
             "Factor.app" useless-files member?
         ] with-variable
     ] unit-test
-] with-directory
+] with-resource-directory
index 95f48109b1210489f181e02c0de503917887908a..b1ffb0bf9016a361109168d5c2b459cb8290ec63 100644 (file)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: furnace furnace.actions furnace.redirection
 http.server.dispatchers html.forms validators urls accessors
-math kernel ;
+math kernel io.directories ;
 IN: webapps.calculator
 
 TUPLE: calculator < dispatcher ;
@@ -36,9 +36,11 @@ USING: db.sqlite furnace.alloy namespaces http.server ;
 : calculator-db ( -- db ) "calculator.db" <sqlite-db> ;
 
 : run-calculator ( -- )
-    <calculator>
-        calculator-db <alloy>
-        main-responder set-global
-    8080 httpd drop ;
+    [
+        <calculator>
+            calculator-db <alloy>
+            main-responder set-global
+        8080 httpd drop
+    ] with-resource-directory ;
 
 MAIN: run-calculator