.app doesn't store resources anymore

slava 2006-08-28 08:03:09 +00:00
parent e9eefe2892
commit 6076d3f0e0
6 changed files with 14 additions and 22 deletions

View File

@ -92,22 +92,6 @@ windows:
macosx.app:
cp $(BINARY) $(BUNDLE)/Contents/MacOS/Factor
rm -rf $(BUNDLE)/Contents/Resources/
mkdir -p $(BUNDLE)/Contents/Resources/fonts/
chmod +x cp_dir
find doc library contrib examples fonts \( -name '*.factor' \
-o -name '*.facts' \
-o -name '*.txt' \
-o -name '*.html' \
-o -name '*.ttf' \
-o -name '*.js' \) \
-exec ./cp_dir {} $(BUNDLE)/Contents/Resources/{} \;
cp version.factor $(BUNDLE)/Contents/Resources/
cp $(IMAGE) $(BUNDLE)/Contents/Resources/factor.image
install_name_tool \
-id @executable_path/../Frameworks/libfreetype.6.dylib \
Factor.app/Contents/Frameworks/libfreetype.6.dylib

View File

@ -46,7 +46,7 @@
- slider needs to be modelized
- continuation handling in walker is screwy
- graphical module manager tool
- figure out what goes in the .app and what doesn't
- fonts/ should go inside the .app -- we need multi-tier resource-path
- should be possible to drop an image file on the .app to run it
- add-gadget, model-changed, set-model should compile
- shortcuts:

View File

@ -75,7 +75,3 @@ FUNCTION: void CFRelease ( void* cf ) ;
] [
"Cannot load bundled named " swap append throw
] ?if ;
: running.app? ( -- ? )
#! Test if we're running Factor.app.
"Contents/Resources" image subseq? ;

View File

@ -10,6 +10,7 @@ USING: cocoa compiler io kernel objc sequences words ;
{
"NSApplication"
"NSAutoreleasePool"
"NSBundle"
"NSError"
"NSEvent"
"NSException"

View File

@ -62,6 +62,12 @@ IN: gadgets
: flush-gl-context ( handle -- )
first -> openGLContext -> flushBuffer ;
: running.app? ( -- ? )
#! Test if we're running Factor.app.
"Factor.app"
NSBundle -> mainBundle -> bundlePath CF>string
subseq? ;
IN: shells
: ui

View File

@ -43,7 +43,12 @@ void early_init(void)
const char *default_image_path(void)
{
NSBundle *bundle = [NSBundle mainBundle];
NSString *image = [[bundle resourcePath] stringByAppendingString:@"/factor.image"];
NSString *path = [bundle bundlePath];
NSString *image;
if([path hasSuffix:@".app"] || [path hasSuffix:@".app/"])
image = [[path stringByDeletingLastPathComponent] stringByAppendingString:@"/factor.image"];
else
image = [path stringByAppendingString:@"/factor.image"];
return [image cString];
}