The idea
In my case I tried to have Trainz installations on a harddrive to use it on any fitting pc/notebook and of course to have all my works with me.The use case
On any pc/notebook there is a link to start the portable installation and the paths of this installation are added to the profile file inside the AppData folder of Trainz. This link works only if the fitting harddrive is available. Also there are two folders on the portable drive: one for the Trainz apps and one for the Trainz appdata.The background informations
Each Trainz installation consists of two file folders, a text file, containing the corresponding paths, and of course a link for the launcher on the desktop.In its properties one will find the installation path of a Trainz installation. In the users appdata folder one will find the absolute path in the "userdata-redirect-map.txt" file as well as the absolute path to the users build folder.
One very important hint: Unlike the paths with backslashes ("\") that Windows uses, here the folders are separated by slashes ("/")!
The app-folder is the install folder of the Trainz core code, the data-folder cares about the user"s Trainz instance data and the profile file tells Trainz where the fitting folders are.
This knowledge makes it possible to make Trainz portable.
The solution draft
The Trainz installation folder is that folder with the Trainz start file "TRS22.exe" in case of Trainz 22, in case of Trainz 19 it is "TRS19.exe". The builds of Trainz 22 and Trainz 19 reside in different subfolders inside the user appdata local N3V Games in the trs22, respective trs19 folder. Following this there are different "userdata-redirect-map.txt" files.The appdata folders have names similar to "build xxxxxxxxx". The "xxxxxxxxx" is a cryptic looking, randomly created character array of letters and numbers. Every new or additional installation gets its own randomly created "xxxxxxxxx".
So very essential at all is to find the fitting folder pairs. Have a look into the "userdata-redirect-map.txt" file inside the user"s appdata folder "%AppData%\..\Local\N3V Games\trs22", respective "%AppData%\..\Local\N3V Games\trs19".
The fitting path pairs have to be written in the "userdata-redirect-map.txt" file, one pair per line. Firstly, the path to the Trains app and secondly, the path to the build folder.
Steps for the draft solution
The following steps are to be done:- Set your harddrive to a fixed drive letter (here: P for portable).
- Create two folders (here: "P:\TRAINZDATA" and "P:\TRAINZAPPS").
- Create in TRAINZDATA an initially empty text file called "userdata-redirect-map.add".
- Copy the fitting build folder content to "P:\TRAINZDATA" and the fitting installation folder content to "P:\TRAINZAPPS".
- Write into the "userdata-redirect-map.add" file, a line per portable installation path pair, adjusted to "P:\TRAINZAPPS" and "P:\TRAINZDATA". Remember using the slash instead of backslash. This file is for copy&past the fitting line to append it to the pc/notebook's "userdata-redirect-map.txt" file.
- Add per installation one starting link for the desktop with the absolute path to the Trainz start exe file in the copied Trainz app folder at drive P. This link is for copying too.
Use case pc/notebook without any earlier Trainz installation
For now I don't know if our Trainz copies are running out of the box on a pc/notebook. If not it's necessary to install a Trainz version.It looks like the calling of trains will generate the AppData folder, but with the content of the "userdata-redirect-map.txt" file, that has to be adapted to the portable drive.
Last but not least a very important hints
Note the content of the original profile file and backup the build folder(s). Note the fitting Trainz version. Be careful.The random parts of the build folder are useful to identify the Trainz installations.
Although I have tested the described procedure to the best of my knowledge, I do not provide any guarantee whatsoever.
Please, do the things at your own risk! I expressly disclaim any liability for this.