Feature #2246

Updated by Matthieu Decorde almost 2 years ago

The TXM Windows launcher builds the TXM user directory path using the %HOMEDRIVE% and %HOMEPATH% environment variables. See #1931 ticket.

If the user unplugs the network (cable/wifi) then the HOMESHARE=HOMEDRIVE+HOMEPATH directory does not exist (IF EXIST) and TXM can't start.

h3. Solution 1

A solution is to test the directory existence in the TXM.bat script and try the %USERPROFILE% path instead.

If the %USERPROFILE% path does not exist also, abort TXM launch.

<pre>
set installdir=%~dp0
set DEBUG=0

set USERHOME=%HOMEDRIVE%%HOMEPATH%
echo "USERHOME=%USERHOME%"
IF EXIST %USERHOME% GOTO USERHOMEOK
set USERHOME=%USERPROFILE%\

IF EXIST %USERHOME% GOTO USERHOMEOK2
echo "HOMEDRIVE+HOMEPATH = %HOMEDRIVE%%HOMEPATH% and USERPROFILE = %USERPROFILE% do not exist. Unable to find TXM configuration, aborting TXM launch."
exit

:USERHOMEOK2
echo "HOMEDRIVE+HOMEPATH = %HOMEDRIVE%%HOMEPATH% does not exist, using USERPROFILE = %USERPROFILE% value instead."

:USERHOMEOK

</pre> set TXMHOME=%USERHOME%TXM\
set DOTTXM=%TXMHOME%.txm\


h3. Solution 2 mkdir "%TXMHOME%"

%HOMEDRIVE%%HOMEPATH% : any pc (first launch, next launches), connected, always access to mkdir "%DOTTXM%"

(
echo "TXM: getting install date from %installdir%STAMP and %DOTTXM%STAMP files"
Fc "%installdir%STAMP" "%DOTTXM%STAMP"
) >"%TXMHOME%TXMOutputLogs.txt" 2>"%TXMHOME%TXMErrorLogs.txt"

IF errorlevel 1 (goto :install) else (goto :run)

:install

(
echo "New TXM install: it's
the same distant drive TXM HOME directory first launch after the installation."
del "%temp%\org.txm.rcpapplication.prefs"
copy "%DOTTXM%configuration\.settings\org.txm.rcpapplication.prefs" "%temp%\org.txm.rcpapplication.prefs"
copy "%DOTTXM%.metadata\.plugins\org.eclipse.core.runtime\.settings\org.txm.rcpapplication.prefs" "%temp%\org.txm.rcpapplication.prefs"
copy "%DOTTXM%data\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.txm.rcpapplication.prefs" "%temp%\org.txm.rcpapplication.prefs"


%USERPROFILE% : same pc (first launch, next launches), connected or not, always access rmdir "%DOTTXM%" /s /q
IF errorlevel 1 (echo "TXM: failed
to the same local drive (C:\) TXM HOME directory delete %DOTTXM% directory.")

mkdir "%DOTTXM%"
IF errorlevel 1 (echo "TXM: failed to create %DOTTXM% directory.")

copy "%installdir%TXM\TXM.ini" "%DOTTXM%TXM.ini"
IF errorlevel 1 (echo "TXM: failed to copy %DOTTXM%TXM.ini file")

copy "%temp%\org.txm.rcpapplication.prefs" "%DOTTXM%org.txm.rcpapplication.prefs"

mkdir "%DOTTXM%user"
IF errorlevel 1 (echo "TXM: failed to create %DOTTXM%user directory.")

mkdir "%DOTTXM%data"
IF errorlevel 1 (echo "TXM: failed to create %DOTTXM%data directory.")

copy "%installdir%STAMP" "%DOTTXM%STAMP"
IF errorlevel 1 (echo "TXM: failed to copy %DOTTXM%STAMP file")

) >"%TXMHOME%TXMOutputLogs.txt" 2>"%TXMHOME%TXMErrorLogs.txt"

:run

(

set _JAVA_OPTIONS=-Duser.home=%USERHOME%

echo running "%installdir%TXM\TXM.exe" -run --launcher.ini "%DOTTXM%TXM.ini" -data "%DOTTXM%data" -user "%DOTTXM%user" -install "%installdir%TXM"

"%installdir%TXM\TXM.exe" -run --launcher.ini "%DOTTXM%TXM.ini" -data "%DOTTXM%data" -user "%DOTTXM%user" -install "%installdir%TXM"

) >"%TXMHOME%TXMOutputLogs.txt" 2>"%TXMHOME%TXMErrorLogs.txt"

</pre>

Back