Revision 19918 trunk/libraries/libRaster/src/org/gvsig/raster/datastruct/serializer/ColorTableLibraryPersistence.java
ColorTableLibraryPersistence.java | ||
---|---|---|
228 | 228 |
* @param palettesPath |
229 | 229 |
*/ |
230 | 230 |
public static void updateVersion_1_0_to_1_1(String palettesBasePath) { |
231 |
File directoryFile = new File(palettesBasePath); |
|
232 |
if (directoryFile.exists()) |
|
233 |
return; |
|
234 |
|
|
231 |
// Si no existe la paleta antigua, pero si que existe la copia de seguridad, |
|
232 |
// la restauramos |
|
235 | 233 |
File palettesFile = new File(new File(palettesBasePath).getParent().toString() + File.separator + "palettes.xml"); |
236 | 234 |
if (!palettesFile.exists()) { |
237 | 235 |
// Cambiar nombre a antiguo fichero |
238 | 236 |
File oldFile = new File(new File(palettesBasePath).getParent().toString() + File.separator + "palettes.xml~"); |
239 |
if (oldFile.exists()) {
|
|
237 |
if (oldFile.exists()) |
|
240 | 238 |
oldFile.renameTo(new File(new File(palettesBasePath).getParent().toString() + File.separator + "palettes.xml")); |
241 |
palettesFile = new File(new File(palettesBasePath).getParent().toString() + File.separator + "palettes.xml"); |
|
242 |
} else { |
|
243 |
return; |
|
244 |
} |
|
245 | 239 |
} |
246 | 240 |
|
241 |
// Si existe el directorio de la version 1.1 no hacemos la migraci?n |
|
242 |
File directoryFile = new File(palettesBasePath); |
|
243 |
if (directoryFile.exists()) |
|
244 |
return; |
|
245 |
|
|
246 |
// Si no encontramos la paleta antigua, nos olvidamos de continuar |
|
247 |
palettesFile = new File(new File(palettesBasePath).getParent().toString() + File.separator + "palettes.xml"); |
|
248 |
if (!palettesFile.exists()) |
|
249 |
return; |
|
250 |
|
|
251 |
// Paleta antigua encontrada, podemos migrar a la versi?n nueva |
|
247 | 252 |
try { |
248 | 253 |
FileInputStream inputStream = new FileInputStream(palettesFile); |
249 | 254 |
|
Also available in: Unified diff