Plugins: Automatic detection of site plugins fails to copy over the content to `_site`

closes #3707
This commit is contained in:
Shay Banon 2013-09-16 18:12:34 +02:00
parent fd4ab5c3dc
commit e271177554
1 changed files with 11 additions and 7 deletions

View File

@ -204,10 +204,14 @@ public class PluginManager {
if (!FileSystemUtils.hasExtensions(extractLocation, ".class", ".jar")) {
log("Identified as a _site plugin, moving to _site structure ...");
File site = new File(extractLocation, "_site");
File tmpLocation = new File(environment.pluginsFile(), name + ".tmp");
extractLocation.renameTo(tmpLocation);
File tmpLocation = new File(environment.pluginsFile(), extractLocation.getName() + ".tmp");
if (!extractLocation.renameTo(tmpLocation)) {
throw new IOException("failed to rename in order to copy to _site (rename to " + tmpLocation.getAbsolutePath() + "");
}
FileSystemUtils.mkdirs(extractLocation);
tmpLocation.renameTo(site);
if (!tmpLocation.renameTo(site)) {
throw new IOException("failed to rename in order to copy to _site (rename to " + site.getAbsolutePath() + "");
}
debug("Installed " + name + " into " + site.getAbsolutePath());
}
}