upgrade the bat script to support running from the script directory
This commit is contained in:
@ -26,7 +26,13 @@ import static net.i2p.update.UpdateType.*;
|
||||
*/
|
||||
public class WinLauncher {
|
||||
private static WindowsUpdatePostProcessor wupp = new WindowsUpdatePostProcessor();
|
||||
private static boolean portable;
|
||||
public static void main(String[] args) throws Exception {
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
if (args[i] == "portable") {
|
||||
portable = true;
|
||||
}
|
||||
}
|
||||
File programs = wupp.selectProgramFile();
|
||||
if (!programs.exists())
|
||||
programs.mkdirs();
|
||||
@ -89,7 +95,7 @@ public class WinLauncher {
|
||||
}
|
||||
|
||||
private static File selectHome() { //throws Exception {
|
||||
if (SystemVersion.isWindows()) {
|
||||
if (SystemVersion.isWindows() && !portable) {
|
||||
File home = new File(System.getProperty("user.home"));
|
||||
File appData = new File(home, "AppData");
|
||||
File local = new File(appData, "Local");
|
||||
@ -100,7 +106,7 @@ public class WinLauncher {
|
||||
} else {
|
||||
File jrehome = new File(System.getProperty("java.home"));
|
||||
File programs = new File(jrehome.getParentFile().getParentFile(), ".i2p");
|
||||
System.out.println("Linux portable jpackage wrapper started, using: " + programs + " as base config");
|
||||
System.out.println("portable jpackage wrapper started, using: " + programs + " as base config");
|
||||
return programs.getAbsoluteFile();
|
||||
}
|
||||
}
|
||||
|
@ -2,40 +2,57 @@
|
||||
|
||||
if exist "%ProgramFiles%\I2P\" (
|
||||
set "I2PPath=%ProgramFiles%\I2P\"
|
||||
set "I2PProfilePath=%ProgramFiles%\I2P\I2PBrowser-Launcher\firefox.profile.i2p"
|
||||
if exist "%LOCALAPPDATA%\I2PBrowser-Launcher\firefox.profile.i2p\" (
|
||||
echo "profile is configured, updating extensions"
|
||||
xcopy /s /i /y "%I2PProfilePath%\extensions" "%LOCALAPPDATA%\I2PBrowser-Launcher\firefox.profile.i2p\extensions"
|
||||
) else (
|
||||
echo "configuring profile"
|
||||
xcopy /s /i /y "%I2PProfilePath%" "%LOCALAPPDATA%\I2PBrowser-Launcher\firefox.profile.i2p"
|
||||
)
|
||||
set "I2PProfilePath=%LOCALAPPDATA%\I2PBrowser-Launcher\firefox.profile.i2p"
|
||||
)
|
||||
|
||||
if exist "%ProgramFiles(x86)%\I2P" {
|
||||
if exist "%ProgramFiles(x86)%\I2P\" {
|
||||
set "I2PPath=%ProgramFiles(x86)%\I2P"
|
||||
set "I2PProfilePath=%ProgramFiles%\I2P\I2PBrowser-Launcher\firefox.profile.i2p"
|
||||
if exist "%LOCALAPPDATA%\I2PBrowser-Launcher\firefox.profile.i2p\" (
|
||||
echo "profile is configured, updating extensions"
|
||||
xcopy /s /i /y "%I2PProfilePath%\extensions" "%LOCALAPPDATA%\I2PBrowser-Launcher\firefox.profile.i2p\extensions"
|
||||
) else (
|
||||
echo "configuring profile"
|
||||
xcopy /s /i /y "%I2PProfilePath%" "%LOCALAPPDATA%\I2PBrowser-Launcher\firefox.profile.i2p"
|
||||
)
|
||||
set "I2PProfilePath=%LOCALAPPDATA%\I2PBrowser-Launcher\firefox.profile.i2p"
|
||||
}
|
||||
|
||||
if exist "%ProgramFiles%\I2P\jpackaged" (
|
||||
start "i2p" /D "%LOCALAPPDATA%\I2P" "%I2PPath%\i2p.exe"
|
||||
set "scriptPath=%~dp0"
|
||||
if exist "%scriptPath%\I2P\" (
|
||||
set "I2PPath=%scriptPath%\I2P\"
|
||||
set "I2PProfilePath=%scriptPath%\"
|
||||
set "PortableArg=portable"
|
||||
)
|
||||
|
||||
if exist "%I2PPath%\jpackaged" (
|
||||
start "i2p" /D "%LOCALAPPDATA%\I2P" "%I2PPath%\i2p.exe" "%PortableArg%"
|
||||
) else (
|
||||
start "i2p" "%I2PPath%\i2p.exe"
|
||||
)
|
||||
|
||||
timeout /t 3
|
||||
|
||||
if exist "%LOCALAPPDATA%\I2PBrowser-Launcher\firefox.profile.i2p\" (
|
||||
echo "profile is configured, updating extensions"
|
||||
xcopy /s /i /y "%ProgramFiles%\I2P\I2PBrowser-Launcher\firefox.profile.i2p\extensions" "%LOCALAPPDATA%\I2PBrowser-Launcher\firefox.profile.i2p\extensions"
|
||||
) else (
|
||||
echo "configuring profile"
|
||||
xcopy /s /i /y "%ProgramFiles%\I2P\I2PBrowser-Launcher\firefox.profile.i2p" "%LOCALAPPDATA%\I2PBrowser-Launcher\firefox.profile.i2p"
|
||||
)
|
||||
|
||||
if exist "%USERPROFILE%/Desktop/Tor Browser/Browser/firefox.exe" (
|
||||
start "i2pbrowser" "%USERPROFILE%/Desktop/Tor Browser/Browser/firefox.exe" -no-remote -profile "%LOCALAPPDATA%\I2PBrowser-Launcher\firefox.profile.i2p" -private-window about:blank
|
||||
start "i2pbrowser" "%USERPROFILE%/Desktop/Tor Browser/Browser/firefox.exe" -no-remote -profile "%I2PProfilePath%" -private-window about:blank
|
||||
exit
|
||||
)
|
||||
|
||||
if exist "%USERPROFILE%/OneDrive/Desktop/Tor Browser/Browser/firefox.exe" (
|
||||
start "i2pbrowser" "%USERPROFILE%/OneDrive/Desktop/Tor Browser/Browser/firefox.exe" -no-remote -profile "%LOCALAPPDATA%\I2PBrowser-Launcher\firefox.profile.i2p" -private-window about:blank
|
||||
start "i2pbrowser" "%USERPROFILE%/OneDrive/Desktop/Tor Browser/Browser/firefox.exe" -no-remote -profile "%I2PProfilePath%" -private-window about:blank
|
||||
exit
|
||||
)
|
||||
|
||||
if exist "%ProgramFiles%\Mozilla Firefox\firefox.exe" (
|
||||
start "i2pbrowser" "%ProgramFiles%\Mozilla Firefox\firefox.exe" -no-remote -profile "%LOCALAPPDATA%\I2PBrowser-Launcher\firefox.profile.i2p" -private-window about:blank
|
||||
start "i2pbrowser" "%ProgramFiles%\Mozilla Firefox\firefox.exe" -no-remote -profile "%I2PProfilePath%" -private-window about:blank
|
||||
exit
|
||||
)
|
||||
|
||||
|
@ -2,28 +2,45 @@
|
||||
|
||||
if exist "%ProgramFiles%\I2P\" (
|
||||
set "I2PPath=%ProgramFiles%\I2P\"
|
||||
set "I2PProfilePath=%ProgramFiles%\I2P\I2PBrowser-Launcher\firefox.profile.i2p"
|
||||
if exist "%LOCALAPPDATA%\I2PBrowser-Launcher\firefox.profile.i2p\" (
|
||||
echo "profile is configured, updating extensions"
|
||||
xcopy /s /i /y "%I2PProfilePath%\extensions" "%LOCALAPPDATA%\I2PBrowser-Launcher\firefox.profile.i2p\extensions"
|
||||
) else (
|
||||
echo "configuring profile"
|
||||
xcopy /s /i /y "%I2PProfilePath%" "%LOCALAPPDATA%\I2PBrowser-Launcher\firefox.profile.i2p"
|
||||
)
|
||||
set "I2PProfilePath=%LOCALAPPDATA%\I2PBrowser-Launcher\firefox.profile.i2p"
|
||||
)
|
||||
|
||||
if exist "%ProgramFiles(x86)%\I2P" {
|
||||
if exist "%ProgramFiles(x86)%\I2P\" {
|
||||
set "I2PPath=%ProgramFiles(x86)%\I2P"
|
||||
set "I2PProfilePath=%ProgramFiles%\I2P\I2PBrowser-Launcher\firefox.profile.i2p"
|
||||
if exist "%LOCALAPPDATA%\I2PBrowser-Launcher\firefox.profile.i2p\" (
|
||||
echo "profile is configured, updating extensions"
|
||||
xcopy /s /i /y "%I2PProfilePath%\extensions" "%LOCALAPPDATA%\I2PBrowser-Launcher\firefox.profile.i2p\extensions"
|
||||
) else (
|
||||
echo "configuring profile"
|
||||
xcopy /s /i /y "%I2PProfilePath%" "%LOCALAPPDATA%\I2PBrowser-Launcher\firefox.profile.i2p"
|
||||
)
|
||||
set "I2PProfilePath=%LOCALAPPDATA%\I2PBrowser-Launcher\firefox.profile.i2p"
|
||||
}
|
||||
|
||||
if exist "%ProgramFiles%\I2P\jpackaged" (
|
||||
start "i2p" /D "%LOCALAPPDATA%\I2P" "%I2PPath%\i2p.exe"
|
||||
set "scriptPath=%~dp0"
|
||||
if exist "%scriptPath%\I2P\" (
|
||||
set "I2PPath=%scriptPath%\I2P\"
|
||||
set "I2PProfilePath=%scriptPath%\"
|
||||
set "PortableArg=portable"
|
||||
)
|
||||
|
||||
if exist "%I2PPath%\jpackaged" (
|
||||
start "i2p" /D "%LOCALAPPDATA%\I2P" "%I2PPath%\i2p.exe" "%PortableArg%"
|
||||
) else (
|
||||
start "i2p" "%I2PPath%\i2p.exe"
|
||||
)
|
||||
|
||||
timeout /t 3
|
||||
|
||||
if exist "%LOCALAPPDATA%\I2PBrowser-Launcher\firefox.profile.i2p\" (
|
||||
echo "profile is configured, updating extensions"
|
||||
xcopy /s /i /y "%ProgramFiles%\I2P\I2PBrowser-Launcher\firefox.profile.i2p\extensions" "%LOCALAPPDATA%\I2PBrowser-Launcher\firefox.profile.i2p\extensions"
|
||||
) else (
|
||||
echo "configuring profile"
|
||||
xcopy /s /i /y "%ProgramFiles%\I2P\I2PBrowser-Launcher\firefox.profile.i2p" "%LOCALAPPDATA%\I2PBrowser-Launcher\firefox.profile.i2p"
|
||||
)
|
||||
|
||||
if exist "%USERPROFILE%/Desktop/Tor Browser/Browser/firefox.exe" (
|
||||
start "i2pbrowser" "%USERPROFILE%/Desktop/Tor Browser/Browser/firefox.exe" -no-remote -profile "%LOCALAPPDATA%\I2PBrowser-Launcher\firefox.profile.i2p" -url %1
|
||||
exit
|
||||
|
Reference in New Issue
Block a user