OSDN Git Service

scene2d.ui Disableable interface.
[mikumikustudio/libgdx-mikumikustudio.git] / backends / gdx-backend-iosmonotouch / src / com / badlogic / gdx / backends / ios / 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 package com.badlogic.gdx.backends.ios;
17
18 import cli.System.Environment;
19 import cli.System.IO.Directory;
20
21 import com.badlogic.gdx.Files;
22 import com.badlogic.gdx.files.FileHandle;
23 import com.badlogic.gdx.utils.GdxRuntimeException;\r
24
25 public class IOSFiles implements Files {
26         static final String externalPath = Environment.GetFolderPath(Environment.SpecialFolder.wrap(Environment.SpecialFolder.MyDocuments));
27         static final String localPath = Directory.GetParent(Environment.GetFolderPath(Environment.SpecialFolder.wrap(Environment.SpecialFolder.MyDocuments))).ToString() + "/Library/local";
28         
29         public IOSFiles() {
30                 new FileHandle(externalPath).mkdirs();
31                 new FileHandle(localPath).mkdirs();
32         }
33         
34         @Override
35         public FileHandle getFileHandle (String fileName, FileType type) {
36                 return new IOSFileHandle(fileName, type);
37         }
38
39         @Override
40         public FileHandle classpath (String path) {\r
41                 throw new GdxRuntimeException("Classpath files are not supported on iOS, this likely happened because you used the default constructor of BitmapFont.");
42         }
43
44         @Override
45         public FileHandle internal (String path) {
46                 return new IOSFileHandle(path, FileType.Internal);
47         }
48
49         @Override
50         public FileHandle external (String path) {
51                 return new IOSFileHandle(path, FileType.External);
52         }
53
54         @Override
55         public FileHandle absolute (String path) {
56                 return new IOSFileHandle(path, FileType.Absolute);
57         }
58
59         @Override
60         public FileHandle local (String path) {
61                 return new IOSFileHandle(path, FileType.Local);
62         }
63
64         @Override
65         public String getExternalStoragePath() {
66                 return externalPath;
67         }
68
69         @Override
70         public boolean isExternalStorageAvailable() {
71                 return true;
72         }
73
74         @Override
75         public String getLocalStoragePath() {\r
76                 // FIXME this doesn't seem to work
77                 return localPath;
78         }
79
80         @Override
81         public boolean isLocalStorageAvailable() {
82                 return true;
83         }
84 }