Changeset 3de1fa2 for apps


Ignore:
Timestamp:
Jun 30, 2018 1:07:41 PM (2 years ago)
Author:
meeh <meeh@…>
Branches:
master
Children:
0b01cc5
Parents:
d8cc2a3
Message:

Minor change in routerconsole and core code for making I2P work great
in "portable" mode.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java

    rd8cc2a3 r3de1fa2  
    77import java.io.Serializable;
    88import java.io.UnsupportedEncodingException;
    9 import java.net.InetAddress;
    10 import java.net.Inet4Address;
    11 import java.net.InetSocketAddress;
    12 import java.net.ServerSocket;
     9import java.net.*;
    1310import java.util.ArrayList;
    1411import java.util.Collections;
     
    411408            System.err.println("ERROR: Unable to create Jetty temporary work directory");
    412409
     410        // NOTE
     411        // This code was added by Meeh @ 22 Apr 2018 for use in the browser bundle.
     412        // In the case of a portable mode, the jar in question isn't routerconsole.jar but itself.
     413        String isPortableStr = System.getProperty("i2p.dir.portableMode");
     414        boolean isPortable = Boolean.parseBoolean(isPortableStr);
     415
     416        String routerConsoleJar = "";
    413417        // so Jetty can find WebAppConfiguration
    414         System.setProperty("jetty.class.path", _context.getBaseDir() + "/lib/routerconsole.jar");
     418        if (isPortable) {
     419            try {
     420                routerConsoleJar = new File(RouterConsoleRunner.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath()).getAbsolutePath();
     421            } catch (URISyntaxException e) {
     422                // This shouln't be able to happen.
     423                System.err.println("ERROR: Fatal portable error, can't locate where I (jarfile) am.");
     424                return; // Yes, cancel at this point.
     425            }
     426        } else {
     427            routerConsoleJar = _context.getBaseDir() + "/lib/routerconsole.jar";
     428        }
     429        System.setProperty("jetty.class.path", routerConsoleJar);
    415430        // FIXME
    416431        // http://dev.eclipse.org/mhonarc/lists/jetty-users/msg03487.html
Note: See TracChangeset for help on using the changeset viewer.