Skip to content
Snippets Groups Projects
Commit 66af07e5 authored by Matyáš Latner's avatar Matyáš Latner
Browse files

#63 Hack to change default libGDX iOS local files path to .../Library/Caches

parent a8b4652e
Branches
Tags
No related merge requests found
package cz.nic.tablexia;
import com.badlogic.gdx.Files;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.backends.iosrobovm.IOSApplication;
import com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration;
import org.robovm.apple.foundation.NSAutoreleasePool;
import org.robovm.apple.foundation.NSBundle;
import org.robovm.apple.foundation.NSDictionary;
import org.robovm.apple.foundation.NSErrorException;
import org.robovm.apple.foundation.NSNumber;
import org.robovm.apple.foundation.NSString;
import org.robovm.apple.foundation.NSURL;
import org.robovm.apple.foundation.NSURLFileSystemProperty;
import org.robovm.apple.glkit.GLKViewDrawableMultisample;
import org.robovm.apple.systemconfiguration.SCNetworkReachability;
import org.robovm.apple.systemconfiguration.SCNetworkReachabilityFlags;
import org.robovm.apple.uikit.UIApplication;
import org.robovm.apple.uikit.UIApplicationLaunchOptions;
import java.net.InetSocketAddress;
import java.util.Locale;
import cz.nic.tablexia.loader.TablexiaAbstractFileManager;
import cz.nic.tablexia.screen.loader.IConnectionManager;
public class IOSLauncher extends IOSApplication.Delegate {
......@@ -32,6 +30,8 @@ public class IOSLauncher extends IOSApplication.Delegate {
private static final String CONNECTION_CHECK_HOST = TablexiaBuildConfig.TABLEXIA_SERVER_HOST != null ? TablexiaBuildConfig.TABLEXIA_SERVER_HOST : FALLBACK_CONNECTION_CHECK_HOST;
private static final Integer CONNECTION_CHECK_PORT = TablexiaBuildConfig.TABLEXIA_SERVER_PORT != null ? TablexiaBuildConfig.TABLEXIA_SERVER_PORT : FALLBACK_CONNECTION_CHECK_PORT;
private TablexiaIOSFiles tablexiaIOSFiles;
@Override
protected IOSApplication createApplication() {
IOSApplicationConfiguration config = new IOSApplicationConfiguration();
......@@ -40,21 +40,29 @@ public class IOSLauncher extends IOSApplication.Delegate {
NSDictionary infoDictionary = NSBundle.getMainBundle().getInfoDictionary();
String buildType = infoDictionary.get(new NSString("cz.nic.tablexia.BuildType")).toString();
tablexiaIOSFiles = new TablexiaIOSFiles();
IOSApplication iosApplication = new IOSApplication(new Tablexia(buildType,
Locale.getDefault(),
SQL_CONNECTION_TYPE,
new IOSConnectionManager(),
false), config);
false), config) {
try {
(new NSURL(TablexiaAbstractFileManager.AssetsStorageType.EXTERNAL.getStoragePath())).setResourceValue(NSURLFileSystemProperty.IsExcludedFromBackup, NSNumber.valueOf(1));
} catch (NSErrorException e) {
e.printStackTrace();
}
@Override
public Files getFiles() {
return tablexiaIOSFiles;
}
};
return iosApplication;
}
@Override
public boolean didFinishLaunching(UIApplication application, UIApplicationLaunchOptions launchOptions) {
boolean result = super.didFinishLaunching(application, launchOptions);
Gdx.files = tablexiaIOSFiles;
return result;
}
public static void main(String[] argv) {
NSAutoreleasePool pool = new NSAutoreleasePool();
UIApplication.main(argv, null, IOSLauncher.class);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment