OSDN Git Service

ran gdx-tools HeaderFixer tool
[mikumikustudio/libgdx-mikumikustudio.git] / backends / gdx-backend-robovm / src / com / badlogic / gdx / backends / iosrobovm / IOSFiles.java
1 /*******************************************************************************\r
2  * Copyright 2011 See AUTHORS file.\r
3  * \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
7  * \r
8  *   http://www.apache.org/licenses/LICENSE-2.0\r
9  * \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  ******************************************************************************/
16
17 package com.badlogic.gdx.backends.iosrobovm;
18
19 import org.robovm.cocoatouch.foundation.NSBundle;
20
21 import com.badlogic.gdx.Files;
22 import com.badlogic.gdx.files.FileHandle;
23
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();
31         
32         public IOSFiles() {
33                 new FileHandle(externalPath).mkdirs();
34                 new FileHandle(localPath).mkdirs();
35         }
36         
37         @Override
38         public FileHandle getFileHandle (String fileName, FileType type) {
39                 return new IOSFileHandle(fileName, type);
40         }
41
42         @Override
43         public FileHandle classpath (String path) {
44                 return new IOSFileHandle(path, FileType.Classpath);
45         }
46
47         @Override
48         public FileHandle internal (String path) {
49                 return new IOSFileHandle(path, FileType.Internal);
50         }
51
52         @Override
53         public FileHandle external (String path) {
54                 return new IOSFileHandle(path, FileType.External);
55         }
56
57         @Override
58         public FileHandle absolute (String path) {
59                 return new IOSFileHandle(path, FileType.Absolute);
60         }
61
62         @Override
63         public FileHandle local (String path) {
64                 return new IOSFileHandle(path, FileType.Local);
65         }
66
67         @Override
68         public String getExternalStoragePath() {
69                 return externalPath;
70         }
71
72         @Override
73         public boolean isExternalStorageAvailable() {
74                 return true;
75         }
76
77         @Override
78         public String getLocalStoragePath() {
79                 return localPath;
80         }
81
82         @Override
83         public boolean isLocalStorageAvailable() {
84                 return true;
85         }
86 }