44 |
44 |
import org.slf4j.Logger;
|
45 |
45 |
import org.slf4j.LoggerFactory;
|
46 |
46 |
import org.apache.commons.io.FileUtils;
|
|
47 |
import org.apache.commons.io.FilenameUtils;
|
47 |
48 |
import org.gvsig.installer.lib.api.PackageInfo;
|
48 |
49 |
import org.gvsig.installer.lib.api.execution.InstallPackageServiceException;
|
49 |
50 |
import org.gvsig.installer.lib.impl.DefaultPackageInfo;
|
... | ... | |
130 |
131 |
option = OPTION_DECOMPRESS;
|
131 |
132 |
this.outputDirectory = outputDirectory;
|
132 |
133 |
FileUtils.forceMkdir(outputDirectory);
|
133 |
|
logger.info("decompress plugin to '"+outputDirectory.getAbsolutePath()+"'.");
|
|
134 |
logger.debug("decompress plugin to '"+outputDirectory.getAbsolutePath()+"'.");
|
134 |
135 |
decompressPlugin(is);
|
135 |
136 |
} catch (Exception e) {
|
136 |
137 |
logger.warn("Can't decompress plugin in '"+outputDirectory+"'.", e);
|
... | ... | |
338 |
339 |
// Return the stream to the initial position
|
339 |
340 |
zis = new ZipInputStream(inputStream);
|
340 |
341 |
while ((entry = zis.getNextEntry()) != null) {
|
341 |
|
entryName = entry.getName();
|
|
342 |
entryName = FilenameUtils.separatorsToSystem(entry.getName());
|
342 |
343 |
taskStatus.message(entryName);
|
343 |
344 |
|
344 |
|
if (File.separatorChar != '/') {
|
345 |
|
entryName = entryName.replace('/', File.separatorChar);
|
346 |
|
}
|
347 |
345 |
File file = new File(outputDirectory, entryName);
|
348 |
346 |
if (file.exists()) {
|
349 |
347 |
logger.info("delete " + file.getAbsolutePath());
|
350 |
|
delete(file);
|
|
348 |
FileUtils.forceDelete(file);
|
351 |
349 |
}
|
352 |
350 |
if (entry.isDirectory()) {
|
353 |
|
if( !entryName.contains("/") ) {
|
|
351 |
String s = FilenameUtils.getPathNoEndSeparator(entryName);
|
|
352 |
if( !s.contains(File.separator) ) {
|
354 |
353 |
if( ++countRootFolders > 1 ) {
|
355 |
|
logger.warn("More than one root folder in the package; it may be an error.");
|
|
354 |
logger.warn("More than one root folder ("+entryName+") in the package; it may be an error.");
|
356 |
355 |
}
|
357 |
356 |
}
|
358 |
357 |
logger.debug("makedirs " + file.getAbsolutePath());
|