forked from I2P_Developers/i2p.i2p
Router: Move continents.txt file into jar
Move core resources directory to be consistent with the other subsystems
This commit is contained in:
@ -1827,7 +1827,6 @@
|
||||
<copy file="build/addressbook.war" todir="pkg-temp/webapps/" />
|
||||
<!-- decapitalized the file in 0.7.8 -->
|
||||
<copy file="installer/resources/countries.txt" todir="pkg-temp/geoip/" />
|
||||
<copy file="installer/resources/continents.txt" todir="pkg-temp/geoip/" />
|
||||
<!--
|
||||
<copy file="installer/resources/public-suffix-list.txt" todir="pkg-temp/geoip/" />
|
||||
-->
|
||||
@ -1846,7 +1845,6 @@
|
||||
<!-- GeoIP files -->
|
||||
<target name="prepgeoupdate" depends="prepgeoupdate-unlesspkg" >
|
||||
<copy file="installer/resources/countries.txt" todir="pkg-temp/geoip/" />
|
||||
<copy file="installer/resources/continents.txt" todir="pkg-temp/geoip/" />
|
||||
<!--
|
||||
<copy file="installer/resources/public-suffix-list.txt" todir="pkg-temp/geoip/" />
|
||||
-->
|
||||
|
@ -109,9 +109,12 @@
|
||||
<target name="jar" depends="compile, bundle, jarUpToDate, listChangedFiles" unless="jar.uptodate" >
|
||||
<!-- set if unset -->
|
||||
<property name="workspace.changes.tr" value="" />
|
||||
<mkdir dir="build/obj/net/i2p/util/resources" />
|
||||
<copy todir="build/obj/net/i2p/util/resources" >
|
||||
<fileset dir="../resources" />
|
||||
</copy>
|
||||
<jar destfile="./build/i2p.jar" >
|
||||
<fileset dir="./build/obj" includes="**/*.class" />
|
||||
<fileset dir="./src" includes="net/i2p/util/resources/*" />
|
||||
<fileset dir="./build/obj" />
|
||||
<!-- the getopt translation files -->
|
||||
<fileset dir="src" includes="${translation.includes}" />
|
||||
<manifest>
|
||||
|
@ -70,7 +70,11 @@
|
||||
<target name="jar" depends="compile, bundle, jarUpToDate, listChangedFiles" unless="jar.uptodate" >
|
||||
<!-- set if unset -->
|
||||
<property name="workspace.changes.tr" value="" />
|
||||
<jar destfile="./build/router.jar" basedir="./build/obj" includes="**/*.class" >
|
||||
<mkdir dir="build/obj/net/i2p/router/util/resources" />
|
||||
<copy todir="build/obj/net/i2p/router/util/resources" >
|
||||
<fileset dir="../resources" />
|
||||
</copy>
|
||||
<jar destfile="./build/router.jar" basedir="./build/obj" >
|
||||
<manifest>
|
||||
<!-- so people with very old wrapper.config files will still work with Jetty 6 -->
|
||||
<attribute name="${manifest.classpath.name}" value="i2p.jar addressbook.jar jetty-i2p.jar jetty-rewrite-handler.jar jetty-start.jar jetty-util.jar" />
|
||||
|
@ -3,7 +3,7 @@ package net.i2p.router.time;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
@ -87,20 +87,14 @@ class Zones {
|
||||
* ref: http://dev.maxmind.com/geoip/legacy/codes/country_continent/
|
||||
*/
|
||||
private void readContinentFile() {
|
||||
String geoDir = _context.getProperty(GeoIP.PROP_GEOIP_DIR, GeoIP.GEOIP_DIR_DEFAULT);
|
||||
File geoFile = new File(geoDir);
|
||||
if (!geoFile.isAbsolute())
|
||||
geoFile = new File(_context.getBaseDir(), geoDir);
|
||||
geoFile = new File(geoFile, CONTINENT_FILE_DEFAULT);
|
||||
if (!geoFile.exists()) {
|
||||
//if (_log.shouldWarn())
|
||||
// _log.warn("Continent file not found: " + geoFile.getAbsolutePath());
|
||||
InputStream is = Zones.class.getResourceAsStream("/net/i2p/router/util/resources/" + CONTINENT_FILE_DEFAULT);
|
||||
if (is == null) {
|
||||
System.out.println("Continent file not found");
|
||||
return;
|
||||
}
|
||||
BufferedReader br = null;
|
||||
try {
|
||||
br = new BufferedReader(new InputStreamReader(
|
||||
new FileInputStream(geoFile), "UTF-8"));
|
||||
br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
|
||||
String line = null;
|
||||
while ((line = br.readLine()) != null) {
|
||||
try {
|
||||
@ -118,8 +112,9 @@ class Zones {
|
||||
} catch (IndexOutOfBoundsException ioobe) {}
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
System.out.println("Error reading the continent file " + geoFile.getAbsolutePath());
|
||||
System.out.println("Error reading the continent file");
|
||||
} finally {
|
||||
try { is.close(); } catch (IOException ioe) {}
|
||||
if (br != null) try { br.close(); } catch (IOException ioe) {}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user