Merge changes from topic 'path'
* changes: SitePaths: Convert static content related paths to Path SitePaths: Convert tmp_dir to Path Convert @SitePath from File to Path
This commit is contained in:
@@ -33,7 +33,7 @@ import com.google.inject.Singleton;
|
||||
import org.eclipse.jgit.lib.Config;
|
||||
import org.eclipse.jgit.lib.PersonIdent;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
|
||||
/**
|
||||
* Copies critical objects from the {@code dbInjector} into a plugin.
|
||||
@@ -47,11 +47,11 @@ import java.io.File;
|
||||
class CopyConfigModule extends AbstractModule {
|
||||
@Inject
|
||||
@SitePath
|
||||
private File sitePath;
|
||||
private Path sitePath;
|
||||
|
||||
@Provides
|
||||
@SitePath
|
||||
File getSitePath() {
|
||||
Path getSitePath() {
|
||||
return sitePath;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import java.io.InputStream;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.nio.file.Files;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
@@ -47,7 +48,8 @@ public class JarPluginProvider implements ServerPluginProvider {
|
||||
|
||||
@Inject
|
||||
JarPluginProvider(SitePaths sitePaths) {
|
||||
tmpDir = sitePaths.tmp_dir;
|
||||
// TODO(dborowitz): Convert to NIO.
|
||||
tmpDir = sitePaths.tmp_dir.toFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -111,10 +113,11 @@ public class JarPluginProvider implements ServerPluginProvider {
|
||||
|
||||
public static File storeInTemp(String pluginName, InputStream in,
|
||||
SitePaths sitePaths) throws IOException {
|
||||
if (!sitePaths.tmp_dir.exists()) {
|
||||
sitePaths.tmp_dir.mkdirs();
|
||||
if (!Files.exists(sitePaths.tmp_dir)) {
|
||||
Files.createDirectories(sitePaths.tmp_dir);
|
||||
}
|
||||
return asTemp(in, tempNameFor(pluginName), ".jar", sitePaths.tmp_dir);
|
||||
return asTemp(in, tempNameFor(pluginName), ".jar",
|
||||
sitePaths.tmp_dir.toFile());
|
||||
}
|
||||
|
||||
private ServerPlugin loadJarPlugin(String name, File srcJar,
|
||||
|
||||
Reference in New Issue
Block a user