java.lang.Object
net.i2p.installer.FixWinPaths
Post-install fixup of the installed wrapper.config on Windows, run by the installer as Main fixwinpaths wrapper.config.
<parsable> substitution leaves in the shipped wrapper.config have to become backslashes. Only the four literal substitutions commented in replace() are applied - the file is not reparsed and paths are not made absolute, because the wrapper already resolves relative paths against its working directory. Other forward slashes in the file are left alone, and are harmless only because the wrapper accepts a mixed-separator path. Usage: FixWinPaths wrapper.configConstructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionstatic voidRewrite the forward slashes in the given wrapper.config to backslashes.private static voidRewrite wrapper.config in place, via a sibling .tmp file.(package private) static booleanreplaceFromTemp(String wConf, String wConfTemp) Put a fully written temp file in place of the original.
Constructor Details
FixWinPaths
public FixWinPaths()Constructor. The rewrite is driven entirely by main() and the platform property, so an instance carries no state.
Method Details
main
Rewrite the forward slashes in the given wrapper.config to backslashes. Does nothing unless os.name starts with "Win".- Parameters:
args- exactly one element, the path of the wrapper.config to fix
replace
Rewrite wrapper.config in place, via a sibling .tmp file. Exits 1 if the rewritten file cannot be put in place, and returns silently if the name is not a wrapper.config.Windows refuses a rename onto an existing file, so the original has to be removed before the temp file can take its name. That ordering makes a failed delete or rename destructive, so both are reported as failures rather than being allowed to look like success, and the temp file is verified before the original is touched.
- Parameters:
file- path of the wrapper.config to rewrite
replaceFromTemp
Put a fully written temp file in place of the original.Refuses to remove the original unless the temp file is present and non-empty, so a truncated or missing temp file cannot leave the install with no wrapper.config at all.
- Parameters:
wConf- path of the original filewConfTemp- path of the rewritten sibling- Returns:
- true if the temp file is now the original