]> gitweb.factorcode.org Git - factor.git/commitdiff
tools.scaffold: refactor to get a home-path word to use in editors
authorDoug Coleman <doug.coleman@gmail.com>
Sat, 28 Jan 2023 04:39:14 +0000 (22:39 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Sat, 28 Jan 2023 04:41:03 +0000 (22:41 -0600)
basis/tools/scaffold/scaffold.factor

index bd0159118c5bc4cc67d842b0d8c6462c01921ca3..d1067f8df4cdec61714a36b04f20a505d0f9d155 100644 (file)
@@ -373,12 +373,17 @@ ${example-indent}}
 : scaffold-examples ( word -- )
     2 swap scaffold-n-examples ;
 
+: ?<pathname> ( obj -- pathname )
+    dup pathname? [ <pathname> ] unless ;
+
 : scaffold-file ( path -- )
     [ touch-file ]
-    [ "Click to edit: " write <pathname> . ] bi ;
+    [ "Click to edit: " write ?<pathname> . ] bi ;
+
+: home-path ( path -- pathname ) home prepend-path ?<pathname> ;
 
 : scaffold-rc ( path -- )
-    home prepend-path scaffold-file ;
+    home-path scaffold-file ;
 
 : scaffold-factor-boot-rc ( -- )
     ".factor-boot-rc" scaffold-rc ;