mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-07 00:38:26 +07:00
Possible IOS read fix
This commit is contained in:
@ -1,3 +1,3 @@
|
|||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||||
archash=60e1edbc61f05c329019d0c5479672a298a9706c
|
archash=22534a12fc0d39eee77e1369c043444999a4e725
|
||||||
|
@ -58,6 +58,40 @@ public class IOSLauncher extends IOSApplication.Delegate{
|
|||||||
if(documentURLs.size() < 1) return;
|
if(documentURLs.size() < 1) return;
|
||||||
|
|
||||||
cont.dismissViewController(true, () -> {});
|
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{
|
try{
|
||||||
controller.importDocument(documentURLs.get(0), new NSURL(getDocumentsDirectory() + "/document"), UIDocumentBrowserImportMode.Copy, (url, error) -> {
|
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){
|
}catch(Throwable t){
|
||||||
ui.showException(t);
|
ui.showException(t);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user