tools.deploy.config.editor assocs hashtables prettyprint
io.backend.unix cocoa io.encodings.utf8 io.backend
cocoa.application cocoa.classes cocoa.plists
-combinators ;
+combinators vocabs.metadata vocabs.loader ;
IN: tools.deploy.macosx
: bundle-dir ( -- dir )
[ bundle-dir prepend-path swap ] keep
"Contents" prepend-path append-path copy-tree ;
-: app-plist ( executable bundle-name -- assoc )
+: app-plist ( icon? executable bundle-name -- assoc )
[
"6.0" "CFBundleInfoDictionaryVersion" set
"APPL" "CFBundlePackageType" set
[ "CFBundleExecutable" set ]
[ "org.factor." prepend "CFBundleIdentifier" set ] bi
+
+ [ "Icon.icns" "CFBundleIconFile" set ] when
] H{ } make-assoc ;
-: create-app-plist ( executable bundle-name -- )
+: create-app-plist ( icon? executable bundle-name -- )
[ app-plist ] keep
"Contents/Info.plist" append-path
write-plist ;
"Resources/English.lproj/MiniFactor.nib" copy-bundle-dir
] [ drop ] if ;
+: copy-icns ( vocab bundle-name -- icon? )
+ swap dup vocab-mac-icon-path vocab-append-path dup exists?
+ [ swap "Contents/Resources/Icon.icns" append-path copy-file t ]
+ [ 2drop f ] if ;
+
: create-app-dir ( vocab bundle-name -- vm )
- [
- nip {
- [ copy-dll ]
- [ copy-nib ]
- [ "Contents/Resources" append-path make-directories ]
- } cleave
- ]
- [ create-app-plist ]
- [ "Contents/MacOS/" append-path copy-vm ] 2tri
+ {
+ [
+ nip {
+ [ copy-dll ]
+ [ copy-nib ]
+ [ "Contents/Resources" append-path make-directories ]
+ } cleave
+ ]
+ [ copy-icns ]
+ [ create-app-plist ]
+ [ "Contents/MacOS/" append-path copy-vm ]
+ } 2cleave
dup OCT: 755 set-file-permissions ;
: deploy.app-image ( vocab bundle-name -- str )
3append throw
] ?if ;
+: vocab-windows-icon-path ( vocab -- string )
+ vocab-dir "icon.ico" append-path ;
+
+: vocab-mac-icon-path ( vocab -- string )
+ vocab-dir "icon.icns" append-path ;
+
: vocab-resources-path ( vocab -- string )
vocab-dir "resources.txt" append-path ;