OSDN Git Service

Add classpath files support for gwt (limited)
[mikumikustudio/libgdx-mikumikustudio.git] / backends / gdx-backends-gwt / src / com / badlogic / gdx / backends / gwt / GwtFiles.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  ******************************************************************************/\r
16 \r
17 package com.badlogic.gdx.backends.gwt;\r
18 \r
19 import com.badlogic.gdx.Files;\r
20 import com.badlogic.gdx.backends.gwt.preloader.Preloader;\r
21 import com.badlogic.gdx.files.FileHandle;\r
22 import com.badlogic.gdx.utils.GdxRuntimeException;\r
23 \r
24 public class GwtFiles implements Files {\r
25         final Preloader preloader;\r
26 \r
27         public GwtFiles (Preloader preloader) {\r
28                 this.preloader = preloader;\r
29         }\r
30 \r
31         @Override\r
32         public FileHandle getFileHandle (String path, FileType type) {\r
33                 if (type != FileType.Internal) throw new GdxRuntimeException("FileType '" + type + "' not supported in GWT backend");\r
34                 return new GwtFileHandle(preloader, path, type);\r
35         }\r
36 \r
37         @Override\r
38         public FileHandle classpath (String path) {\r
39                 return new GwtFileHandle(preloader, path, FileType.Classpath);\r
40 //              throw new GdxRuntimeException("Not supported in GWT backend");\r
41         }\r
42 \r
43         @Override\r
44         public FileHandle internal (String path) {\r
45                 return new GwtFileHandle(preloader, path, FileType.Internal);\r
46         }\r
47 \r
48         @Override\r
49         public FileHandle external (String path) {\r
50                 throw new GdxRuntimeException("Not supported in GWT backend");\r
51         }\r
52 \r
53         @Override\r
54         public FileHandle absolute (String path) {\r
55                 throw new GdxRuntimeException("Not supported in GWT backend");\r
56         }\r
57 \r
58         @Override\r
59         public FileHandle local (String path) {\r
60                 throw new GdxRuntimeException("Not supported in GWT backend");\r
61         }\r
62 \r
63         @Override\r
64         public String getExternalStoragePath () {\r
65                 return null;\r
66         }\r
67 \r
68         @Override\r
69         public boolean isExternalStorageAvailable () {\r
70                 return false;\r
71         }\r
72 \r
73         @Override\r
74         public String getLocalStoragePath () {\r
75                 return null;\r
76         }\r
77 \r
78         @Override\r
79         public boolean isLocalStorageAvailable () {\r
80                 return false;\r
81         }\r
82 }\r