mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-03 04:44:24 +07:00
Possible IOS read fix
This commit is contained in:
parent
4c0607aba8
commit
d6822c9c7d
@ -1,3 +1,3 @@
|
||||
org.gradle.daemon=true
|
||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||
archash=60e1edbc61f05c329019d0c5479672a298a9706c
|
||||
archash=22534a12fc0d39eee77e1369c043444999a4e725
|
||||
|
@ -58,6 +58,40 @@ public class IOSLauncher extends IOSApplication.Delegate{
|
||||
if(documentURLs.size() < 1) return;
|
||||
|
||||
cont.dismissViewController(true, () -> {});
|
||||
NSFileCoordinator coord = new NSFileCoordinator(null);
|
||||
try{
|
||||
coord.coordinateReadingItem(documentURLs.get(0), NSFileCoordinatorReadingOptions.None, url -> {
|
||||
NSInputStream stream = new NSInputStream(NSData.read(url));
|
||||
|
||||
cons.get(new FileHandle(url.getPath()){
|
||||
@Override
|
||||
public InputStream read(){
|
||||
return new InputStream(){
|
||||
byte[] tmp = {0};
|
||||
|
||||
@Override
|
||||
public int read() throws IOException{
|
||||
read(tmp);
|
||||
return tmp[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] bytes, int offset, int length){
|
||||
return (int)stream.read(bytes, offset, length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException{
|
||||
stream.close();
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
}catch(Throwable t){
|
||||
ui.showException(t);
|
||||
}
|
||||
/*
|
||||
|
||||
try{
|
||||
controller.importDocument(documentURLs.get(0), new NSURL(getDocumentsDirectory() + "/document"), UIDocumentBrowserImportMode.Copy, (url, error) -> {
|
||||
@ -73,7 +107,7 @@ public class IOSLauncher extends IOSApplication.Delegate{
|
||||
});
|
||||
}catch(Throwable t){
|
||||
ui.showException(t);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user