This is used together with the Browser Bundle.
This class is slim/light because the initial config is deployed by I2PCtrl.js if the config directory is missing from the relative directory it's using, and if any migrations is needed, I2PCtrl.js will do that part.
In the future BB might have flavors or plugins which would be apps normally distributed with default install of i2p, and other plugins available. I2PCtrl.js will manage these since it's closer to the end-user via browser options and GUI.
Just FYI: In the context of a BB:
On OSX it has to look 3 paths up, but for the other two, only one.
OSX Path: I2PBrowser.app/Contents/MacOS/firefox
OSX => ../../../I2PBrowser-Data/I2P Linux/Windows => ../I2PBrowser-Data/I2P
---- However,
The javascript plugin I2PCtrl.js is setting correct working and base directory so this class can be quite dumb.
Working directory is where we have most of our config, and keys.
Base directory is where we usually find the wrapper config (on normal installs) together with jars and static files in an I2P installation.
Portable uses both, with the key usage being that I2P is extracted from (whatever) to a base directory, but still has it's config separate in the working directory.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringWrapper log moved out of the way when it sits in the home directory.private static final StringProperty naming the installation directory.private static final StringProperty naming the working directory.private static final StringWe do a couple of things differently if this is the username.Constructor Summary
ConstructorsModifierConstructorDescriptionprivateUtility class, not intended for instantiation.Method Summary
Modifier and TypeMethodDescriptionstatic StringgetWorkingDir(Properties envProps) Only call this once on router invocation.private static voidsetupSystemOut(String dir) Redirect stdout and stderr to a wrapper.log file if there is no wrapper, unless system property I2P_DISABLE_OUTPUT_OVERRIDE is set.
Field Details
PROP_BASE_DIR
Property naming the installation directory.- See Also:
PROP_WORKING_DIR
Property naming the working directory.- See Also:
PROP_WRAPPER_LOG
We do a couple of things differently if this is the username.- See Also:
DEFAULT_WRAPPER_LOG
Wrapper log moved out of the way when it sits in the home directory.- See Also:
Constructor Details
PortableWorkingDir
private PortableWorkingDir()Utility class, not intended for instantiation.
Method Details
getWorkingDir
Only call this once on router invocation. Caller should store the return value for future reference.- Parameters:
envProps- launcher's environment, read fori2p.dir.configandi2p.dir.base; may be null, in which case System properties are consulted instead- Returns:
- the working directory path
setupSystemOut
Redirect stdout and stderr to a wrapper.log file if there is no wrapper, unless system property I2P_DISABLE_OUTPUT_OVERRIDE is set.If there is no -Dwrapper.log=/path/to/wrapper.log on the java command line to specify a log file, check for existence of wrapper.log in CWD, for backward compatibility in old installations (don't move it). Otherwise, use (system temp dir)/wrapper.log. Create if it doesn't exist, and append to it if it does. Put the location in the environment as an absolute path, so logs.jsp can find it.
- Parameters:
dir- if null, use Java temp dir; System property wrapper.logfile overrides