]> gitweb.factorcode.org Git - factor.git/blob - basis/core-foundation/bundles/bundles.factor
790f1766c39666bb2151af301aeb0de369c59edd
[factor.git] / basis / core-foundation / bundles / bundles.factor
1 ! Copyright (C) 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: alien.syntax kernel sequences core-foundation
4 core-foundation.urls ;
5 IN: core-foundation.bundles
6
7 TYPEDEF: void* CFBundleRef
8
9 FUNCTION: CFBundleRef CFBundleCreate ( CFAllocatorRef allocator, CFURLRef bundleURL ) ;
10
11 FUNCTION: Boolean CFBundleLoadExecutable ( CFBundleRef bundle ) ;
12
13 : <CFBundle> ( string -- bundle )
14     t <CFFileSystemURL> [
15         f swap CFBundleCreate
16     ] keep CFRelease ;
17
18 : load-framework ( name -- )
19     dup <CFBundle> [
20         CFBundleLoadExecutable drop
21     ] [
22         "Cannot load bundle named " prepend throw
23     ] ?if ;