gitiles-dev: use nio.Path rather than io.File for sourceRoot. Change-Id: Iea5339dacd6c0805386c80558d96e93f64056e3a
diff --git a/gitiles-dev/src/main/java/com/google/gitiles/dev/DevServer.java b/gitiles-dev/src/main/java/com/google/gitiles/dev/DevServer.java index 7150b19..faa6ee5 100644 --- a/gitiles-dev/src/main/java/com/google/gitiles/dev/DevServer.java +++ b/gitiles-dev/src/main/java/com/google/gitiles/dev/DevServer.java
@@ -137,12 +137,12 @@ return dir; } - private final File sourceRoot; + private final Path sourceRoot; private final Config cfg; private final Server httpd; DevServer(File cfgFile) throws IOException, ConfigInvalidException { - sourceRoot = findSourceRoot().toFile(); + sourceRoot = findSourceRoot(); Config cfg = defaultConfig(); if (cfgFile.exists() && cfgFile.isFile()) { @@ -174,8 +174,8 @@ DebugRenderer renderer = new DebugRenderer( STATIC_PREFIX, Arrays.asList(cfg.getStringList("gitiles", null, "customTemplates")), - new File(sourceRoot, "gitiles-servlet/src/main/resources/com/google/gitiles/templates") - .getPath(), + sourceRoot.resolve("gitiles-servlet/src/main/resources/com/google/gitiles/templates") + .toString(), firstNonNull(cfg.getString("gitiles", null, "siteTitle"), "Gitiles")); String docRoot = cfg.getString("gitiles", null, "docroot"); @@ -196,11 +196,11 @@ } private Handler staticHandler() throws IOException { - File staticRoot = new File(sourceRoot, + Path staticRoot = sourceRoot.resolve( "gitiles-servlet/src/main/resources/com/google/gitiles/static"); ResourceHandler rh = new ResourceHandler(); try { - rh.setBaseResource(new FileResource(staticRoot.toURI().toURL())); + rh.setBaseResource(new FileResource(staticRoot.toUri().toURL())); } catch (URISyntaxException e) { throw new IOException(e); }