Plugins: fix error message while copying plugin config dir

The destination directory is the plugin config dir, not bin. Also updated existing code to reuse already declared destBin and destConfig variables.
This commit is contained in:
javanna 2015-10-09 14:31:25 +02:00 committed by Luca Cavanna
parent 1a50ce73d7
commit d5e6f34e68
1 changed files with 4 additions and 4 deletions

View File

@ -255,7 +255,7 @@ public class PluginManager {
copyBinDirectory(sourcePluginBinDirectory, destPluginBinDirectory, pluginHandle.name, terminal); copyBinDirectory(sourcePluginBinDirectory, destPluginBinDirectory, pluginHandle.name, terminal);
} catch (IOException e) { } catch (IOException e) {
// rollback and remove potentially before installed leftovers // rollback and remove potentially before installed leftovers
terminal.printError("Error copying bin directory [%s] to [%s], cleaning up, reason: %s", sourcePluginBinDirectory, pluginHandle.binDir(environment), e.getMessage()); terminal.printError("Error copying bin directory [%s] to [%s], cleaning up, reason: %s", sourcePluginBinDirectory, destPluginBinDirectory, e.getMessage());
tryToDeletePath(terminal, extractLocation, pluginHandle.binDir(environment)); tryToDeletePath(terminal, extractLocation, pluginHandle.binDir(environment));
throw e; throw e;
} }
@ -267,7 +267,7 @@ public class PluginManager {
boolean needToCopyConfigDirectory = Files.exists(sourceConfigDirectory); boolean needToCopyConfigDirectory = Files.exists(sourceConfigDirectory);
if (needToCopyConfigDirectory) { if (needToCopyConfigDirectory) {
if (Files.exists(destConfigDirectory) && !Files.isDirectory(destConfigDirectory)) { if (Files.exists(destConfigDirectory) && !Files.isDirectory(destConfigDirectory)) {
tryToDeletePath(terminal, extractLocation, pluginHandle.binDir(environment)); tryToDeletePath(terminal, extractLocation, destPluginBinDirectory);
throw new IOException("plugin config directory " + destConfigDirectory + " is not a directory"); throw new IOException("plugin config directory " + destConfigDirectory + " is not a directory");
} }
@ -276,8 +276,8 @@ public class PluginManager {
moveFilesWithoutOverwriting(sourceConfigDirectory, destConfigDirectory, ".new"); moveFilesWithoutOverwriting(sourceConfigDirectory, destConfigDirectory, ".new");
terminal.println(VERBOSE, "Installed %s into %s", pluginHandle.name, destConfigDirectory.toAbsolutePath()); terminal.println(VERBOSE, "Installed %s into %s", pluginHandle.name, destConfigDirectory.toAbsolutePath());
} catch (IOException e) { } catch (IOException e) {
terminal.printError("Error copying config directory [%s] to [%s], cleaning up, reason: %s", sourceConfigDirectory, pluginHandle.binDir(environment), e.getMessage()); terminal.printError("Error copying config directory [%s] to [%s], cleaning up, reason: %s", sourceConfigDirectory, destConfigDirectory, e.getMessage());
tryToDeletePath(terminal, extractLocation, pluginHandle.binDir(environment), pluginHandle.configDir(environment)); tryToDeletePath(terminal, extractLocation, destPluginBinDirectory, destConfigDirectory);
throw e; throw e;
} }
} }