]> gitweb.factorcode.org Git - factor.git/commitdiff
gpu.shaders: simplified in-word's-path
authorBjörn Lindqvist <bjourne@gmail.com>
Sun, 28 Jan 2018 02:43:01 +0000 (03:43 +0100)
committerBjörn Lindqvist <bjourne@gmail.com>
Mon, 29 Jan 2018 11:12:07 +0000 (12:12 +0100)
extra/gpu/shaders/shaders-tests.factor
extra/gpu/shaders/shaders.factor

index b4b802d36891387ff0255c66c586ce83a26cf1e9..e97144126c718d5eda55989919887dbf87b0995b 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2009 Joe Groff.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: multiline gpu.shaders gpu.shaders.private tools.test ;
+USING: gpu.shaders gpu.shaders.private io.pathnames tools.test ;
 IN: gpu.shaders.tests
 
 { "ERROR: foo.factor:20: Bad command or filename
@@ -10,3 +10,9 @@ NOT:A:LOG:LINE"  }
 "ERROR: 0:1: Bad command or filename
 INFO: 0:11: The operation completed successfully
 NOT:A:LOG:LINE" replace-log-line-numbers ] unit-test
+
+SYMBOL: a-test-symbol
+
+{ "shaders" } [
+    a-test-symbol word-directory file-name
+] unit-test
index 3793975dea029298cf4211da3e2865ab5805e4dc..1ea5b1d31f1c9409ba90dd04b86b1cd1c9ff9990 100755 (executable)
@@ -494,8 +494,11 @@ DEFER: <shader-instance>
 : link-program ( program -- program-instance )
     dup shaders>> [ <shader-instance> ] map (link-program) ;
 
+: word-directory ( word -- directory )
+    where first parent-directory ;
+
 : in-word's-path ( word kind filename -- word kind filename' )
-    [ over ] dip [ where first parent-directory ] dip append-path ;
+    pick word-directory prepend-path ;
 
 : become-shader-instance ( shader-instance new-shader-instance -- )
     handle>> [ swap delete-gl-shader ] curry change-handle drop ;