mirror of
https://github.com/status-im/react-native-fs.git
synced 2025-02-28 23:10:29 +00:00
Merge pull request #14 from MattFoley/feature-bundle-load
Update to load Bundles by their class name if not found in typical bundle path.
This commit is contained in:
commit
6b9b98b07f
@ -127,14 +127,27 @@ RCT_EXPORT_METHOD(pathForBundle:(NSString *)bundleNamed
|
||||
{
|
||||
NSString *path = [[NSBundle mainBundle].bundlePath stringByAppendingFormat:@"/%@.bundle", bundleNamed];
|
||||
NSBundle *bundle = [NSBundle bundleWithPath:path];
|
||||
|
||||
if (!bundle) {
|
||||
bundle = [NSBundle bundleForClass:NSClassFromString(bundleNamed)];
|
||||
path = bundle.bundlePath;
|
||||
}
|
||||
|
||||
if (!bundle.isLoaded) {
|
||||
[bundle load];
|
||||
}
|
||||
|
||||
callback(@[[NSNull null], path]);
|
||||
if (path) {
|
||||
callback(@[[NSNull null], path]);
|
||||
} else {
|
||||
callback(@[[NSError errorWithDomain:NSPOSIXErrorDomain
|
||||
code:NSFileNoSuchFileError
|
||||
userInfo:nil].localizedDescription,
|
||||
[NSNull null]]);
|
||||
}
|
||||
}
|
||||
|
||||
- (NSNumber *) dateToTimeIntervalNumber:(NSDate *)date
|
||||
- (NSNumber *)dateToTimeIntervalNumber:(NSDate *)date
|
||||
{
|
||||
return @([date timeIntervalSince1970]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user