1 /*******************************************************************************
\r
2 * Copyright 2011 See AUTHORS file.
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
15 ******************************************************************************/
17 package com.badlogic.gdx.backends.iosrobovm;
19 import org.robovm.cocoatouch.foundation.NSBundle;
21 import com.badlogic.gdx.Files;
22 import com.badlogic.gdx.files.FileHandle;
24 public class IOSFiles implements Files {
25 // TODO: Use NSSearchPathForDirectoriesInDomains instead?
26 // $HOME should point to the app root dir.
27 static final String appDir = System.getenv("HOME");
28 static final String externalPath = appDir + "/Documents";
29 static final String localPath = appDir + "/Library/local";
30 static final String internalPath = NSBundle.getMainBundle().getBundlePath();
33 new FileHandle(externalPath).mkdirs();
34 new FileHandle(localPath).mkdirs();
38 public FileHandle getFileHandle (String fileName, FileType type) {
39 return new IOSFileHandle(fileName, type);
43 public FileHandle classpath (String path) {
44 return new IOSFileHandle(path, FileType.Classpath);
48 public FileHandle internal (String path) {
49 return new IOSFileHandle(path, FileType.Internal);
53 public FileHandle external (String path) {
54 return new IOSFileHandle(path, FileType.External);
58 public FileHandle absolute (String path) {
59 return new IOSFileHandle(path, FileType.Absolute);
63 public FileHandle local (String path) {
64 return new IOSFileHandle(path, FileType.Local);
68 public String getExternalStoragePath() {
73 public boolean isExternalStorageAvailable() {
78 public String getLocalStoragePath() {
83 public boolean isLocalStorageAvailable() {