show documents directory in iOS 11 files

This commit is contained in:
Jesús A. Álvarez 2018-04-28 11:50:22 +02:00
parent a6e6014220
commit 1700d38dd7
3 changed files with 38 additions and 9 deletions

View File

@ -1624,6 +1624,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = UJXNDZ5TNU;
HEADER_SEARCH_PATHS = "$(SRCROOT)";
INFOPLIST_FILE = "Mini vMac/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
@ -1641,6 +1642,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = UJXNDZ5TNU;
HEADER_SEARCH_PATHS = "$(SRCROOT)";
INFOPLIST_FILE = "Mini vMac/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;

View File

@ -294,6 +294,17 @@ NSString *DocumentsChangedNotification = @"documentsChanged";
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
NSMutableDictionary *options = [NSMutableDictionary dictionaryWithCapacity:2];
if (sourceApplication) {
options[UIApplicationOpenURLOptionsSourceApplicationKey] = sourceApplication;
}
if (annotation) {
options[UIApplicationOpenURLOptionsAnnotationKey] = annotation;
}
return [self application:application openURL:url options:options];
}
- (BOOL)importFileToDocuments:(NSURL *)url {
if (url.fileURL) {
// opening file
NSFileManager *fileManager = [NSFileManager defaultManager];
@ -323,4 +334,22 @@ NSString *DocumentsChangedNotification = @"documentsChanged";
return YES;
}
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
if (url.fileURL) {
// opening file
if ([url.path.stringByStandardizingPath hasPrefix:self.documentsPath]) {
// already in documents - mount
[sharedEmulator insertDisk:url.path];
} else if ([options[UIApplicationOpenURLOptionsOpenInPlaceKey] boolValue]) {
// not in documents - copy
[url startAccessingSecurityScopedResource];
[self importFileToDocuments:url];
[url stopAccessingSecurityScopedResource];
} else {
return [self importFileToDocuments:url];
}
}
return YES;
}
@end

View File

@ -11,10 +11,8 @@
<array/>
<key>CFBundleTypeName</key>
<string>Disk Image</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.apple.disk-image</string>
@ -25,10 +23,8 @@
<array/>
<key>CFBundleTypeName</key>
<string>Disk Copy 4.2 Disk Image</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.apple.disk-image-dc42</string>
@ -39,16 +35,16 @@
<array/>
<key>CFBundleTypeName</key>
<string>ROM image</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>net.namedfork.minivmac.rom</string>
</array>
</dict>
<dict>
<key>CFBundleTypeIconFiles</key>
<array/>
<key>CFBundleTypeName</key>
<string>Unknown File</string>
<key>LSHandlerRank</key>
@ -79,6 +75,8 @@
<string>9</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>