Commit cb58cd4d authored by Drahomír Karchňák's avatar Drahomír Karchňák

Fixed IOS FileSystemManager's implementation.

parent 3d2f6532
...@@ -36,6 +36,8 @@ import org.robovm.apple.systemconfiguration.SCNetworkReachabilityFlags; ...@@ -36,6 +36,8 @@ import org.robovm.apple.systemconfiguration.SCNetworkReachabilityFlags;
import org.robovm.apple.uikit.UIApplication; import org.robovm.apple.uikit.UIApplication;
import org.robovm.apple.uikit.UIApplicationLaunchOptions; import org.robovm.apple.uikit.UIApplicationLaunchOptions;
import java.io.File;
import java.io.IOException;
import java.util.Locale; import java.util.Locale;
import cz.nic.tablexia.screen.loader.IConnectionManager; import cz.nic.tablexia.screen.loader.IConnectionManager;
...@@ -147,8 +149,19 @@ public class IOSLauncher extends IOSApplication.Delegate { ...@@ -147,8 +149,19 @@ public class IOSLauncher extends IOSApplication.Delegate {
@Override @Override
public Long getSpaceAvailable(String path) { public Long getSpaceAvailable(String path) {
try { try {
File file = new File(path);
if(!file.exists()) {
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
NSFileSystemAttributes fileSystemAttributes = NSFileManager.getDefaultManager().getAttributesOfFileSystemAtPath(path); NSFileSystemAttributes fileSystemAttributes = NSFileManager.getDefaultManager().getAttributesOfFileSystemAtPath(path);
return fileSystemAttributes.getFreeSize(); long result = fileSystemAttributes.getFreeSize();
file.delete();
return result;
} catch (NSErrorException e) { } catch (NSErrorException e) {
Log.err(getClass(), "Can't get free space for path: " + path + "!", e); Log.err(getClass(), "Can't get free space for path: " + path + "!", e);
} }
......
Markdown is supported
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