 ! Copyright (C) 2007 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: io io.files io.launcher kernel namespaces sequences
-system cocoa.plists cocoa.application tools.deploy
-tools.deploy.config assocs hashtables prettyprint ;
+system tools.deploy tools.deploy.config assocs hashtables
+prettyprint unix io.unix.backend cocoa cocoa.plists
+cocoa.application cocoa.classes ;
 IN: tools.deploy.macosx
 
 : touch ( path -- )
-    "touch \"" swap "\"" 3append run-process ;
+    { "touch" } swap add run-process ;
 
 : rm ( path -- )
-    "rm -rf \"" swap "\"" 3append run-process ;
-
-: chmod ( path perms -- )
-    [ "chmod " % % " \"" % % "\"" % ] "" make run-process ;
+    { "rm" "-rf" } swap add run-process ;
 
 : bundle-dir ( -- dir )
     vm parent-directory parent-directory ;

        bundle-name rm
        [ bundle-name create-app-dir ] keep
        [ bundle-name deploy.app-image ] keep
        namespace
    ] bind deploy* ;


T{ macosx-deploy-implementation } deploy-implementation set-global

: show-in-finder ( path -- )
    NSWorkspace
    -> sharedWorkspace
    over <NSString> rot parent-directory <NSString>
    -> selectFile:inFileViewerRootedAtPath: drop ;

M: macosx-deploy-implementation deploy ( vocab -- )
    ".app deploy tool" assert.app
    "." resource-path cd
