00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 @import "CPObject.j"
00024 @import "CPDictionary.j"
00025
00026
00027 @implementation CPBundle : CPObject
00028 {
00029 Class _principalClass;
00030 }
00031
00032 + (id)alloc
00033 {
00034 return new objj_bundle;
00035 }
00036
00037 + (CPBundle)bundleWithPath:(CPString)aPath
00038 {
00039 return objj_getBundleWithPath(aPath);
00040 }
00041
00042 + (CPBundle)bundleForClass:(Class)aClass
00043 {
00044 return objj_bundleForClass(aClass);
00045 }
00046
00047 + (CPBundle)mainBundle
00048 {
00049 return [CPBundle bundleWithPath:"Info.plist"];
00050 }
00051
00052 - (Class)classNamed:(CPString)aString
00053 {
00054
00055 }
00056
00057 - (CPString)bundlePath
00058 {
00059 return [path stringByDeletingLastPathComponent];
00060 }
00061
00062 - (CPString)resourcePath
00063 {
00064 var resourcePath = [self bundlePath];
00065
00066 if (resourcePath.length)
00067 resourcePath += '/';
00068
00069 return resourcePath + "Resources";
00070 }
00071
00072 - (Class)principalClass
00073 {
00074 var className = [[self infoDictionary] objectForKey:@"CPPrincipalClass"];
00075
00076
00077
00078 return className ? CPClassFromString(className) : Nil;
00079 }
00080
00081 - (CPDictionary)infoDictionary
00082 {
00083 return info;
00084 }
00085
00086 - (id)objectForInfoDictionaryKey:(CPString)aKey
00087 {
00088 return [info objectForKey:aKey];
00089 }
00090
00091 @end
00092
00093 objj_bundle.prototype.isa = CPBundle;