source: installer/resources/fix_logfile_path.cmd @ ab58875

Last change on this file since ab58875 was ab58875, checked in by kytv <kytv@…>, 9 years ago

The comment is no longer accurate (the file still has UNIX line endings) since
we're using findstr

  • Property mode set to 100644
File size: 1.6 KB
1@echo off
2:: fix_logfile_path.cmd
4:: This is a simple (and/or stupid) script whose sole purpose is to set the
5:: correct path for wrapper.logfile, by explicitly setting it to use the
6:: environment variable %temp%.
8:: On every *NIX-like system, $SYSTEM_java_io_tmpdir/wrapper.log points to a system-level
9:: temp directory (/tmp on Linux, /var/tmp on BSD, etc.), but in Windows the value of %temp%
10:: depends on whose account a process is running under. If the same user that installs I2P
11:: is the only one that will run I2P, this isn't a problem.
13:: The problem comes from trying to run the process as a service, or trying to run under an
14:: account other than the one that did the installation. For example if the user "Administrator"
15:: installed I2P on Windows 7, the value for wrapper.logfile will be set to the hardcoded value of
16:: C:\Users\Administrator\AppData\Local\Temp\wrapper.log (if it's left at the default value of
17:: $SYSTEM_java_io_tmpdir/wrapper.log.
19:: If user Alice tries to run I2P, the wrapper will try to write its logfile to
20:: C:\Users\Administrator\AppData\Local\Temp\wrapper.log. Unfortunately Alice
21:: doesn't have the rights to access Administrator's temp directory. The same
22:: will happen with the "limited access account" that the I2P service runs
23:: under.
25:: Since Windows doesn't have sed and it has a retarded find, we resort to this
26:: lameness.
28cd /d %~dp0
29findstr /V /R "^wrapper.logfile=" wrapper.config >
30echo wrapper.logfile=%%temp%%\wrapper.log >>
31move wrapper.config
Note: See TracBrowser for help on using the repository browser.