Revision 11003 trunk/frameworks/_fwAndami/src/com/iver/andami/iconthemes/IconThemeManager.java
IconThemeManager.java | ||
---|---|---|
43 | 43 |
|
44 | 44 |
import java.io.File; |
45 | 45 |
import java.io.FileInputStream; |
46 |
import java.io.FileNotFoundException; |
|
46 | 47 |
import java.io.IOException; |
47 | 48 |
import java.io.InputStream; |
48 | 49 |
import java.util.ArrayList; |
... | ... | |
64 | 65 |
* <?xml version="1.0" encoding="utf-8"?> |
65 | 66 |
* <theme> |
66 | 67 |
* <name>Default gvSIG icon theme</name> |
67 |
* <description>Clear fancy super great icon theme for gvSIG. Author: Salvador Dal?, <salvador.dali@art.org> </description>
|
|
68 |
* <description>Clear fancy super great icon theme for gvSIG. Author: Salvador Dal?, &lt;salvador.dali@art.org&gt;</description>
|
|
68 | 69 |
* <version>1.2</version> |
69 | 70 |
* </theme> |
70 | 71 |
* </pre> |
... | ... | |
81 | 82 |
* |
82 | 83 |
* @param themesDir |
83 | 84 |
*/ |
84 |
public IconThemeManager(File themesDir) { |
|
85 |
this.themesDir = themesDir; |
|
85 |
public IconThemeManager(File themesDir) throws FileNotFoundException { |
|
86 |
if (!themesDir.exists()) |
|
87 |
throw new FileNotFoundException(); |
|
88 |
this.themesDir = themesDir; |
|
86 | 89 |
} |
87 | 90 |
|
88 | 91 |
/** |
... | ... | |
122 | 125 |
return themeInfo; |
123 | 126 |
} |
124 | 127 |
} catch (IOException e) {} |
125 |
catch (XmlPullParserException e) {} |
|
128 |
catch (XmlPullParserException e) { |
|
129 |
e.printStackTrace(); |
|
130 |
} |
|
126 | 131 |
// the XML parsing failed, just show the dir name |
127 | 132 |
themeInfo = new IconThemeInfo(); |
128 | 133 |
themeInfo.setName(dir.getName()); |
... | ... | |
165 | 170 |
if (entry.isDirectory()) { |
166 | 171 |
dirEntry = entry; |
167 | 172 |
} |
168 |
if (entry.getName().equals(themeDefinitionFile)) {
|
|
173 |
if (basename(entry.getName()).equals(themeDefinitionFile)) {
|
|
169 | 174 |
xmlEntry = entry; |
170 | 175 |
} |
171 | 176 |
} |
... | ... | |
175 | 180 |
if (xmlEntry!=null) { |
176 | 181 |
themeInfo = readXML(file.getInputStream(xmlEntry)); |
177 | 182 |
themeInfo.setResource(zipFile); |
183 |
return themeInfo; |
|
178 | 184 |
} |
179 |
} catch (XmlPullParserException e) {} |
|
185 |
} catch (XmlPullParserException e) { |
|
186 |
e.printStackTrace(); |
|
187 |
System.out.println(file.getName()); |
|
188 |
} |
|
180 | 189 |
|
181 | 190 |
themeInfo = new IconThemeInfo(); |
182 | 191 |
themeInfo.setResource(zipFile); |
... | ... | |
203 | 212 |
return null; |
204 | 213 |
} |
205 | 214 |
|
215 |
private String basename(String fullname) { |
|
216 |
String[] parts = fullname.split(File.separator+"|/"); |
|
217 |
return parts[parts.length-1]; |
|
218 |
} |
|
206 | 219 |
|
220 |
|
|
207 | 221 |
} |
Also available in: Unified diff