Question:
How can I ensure that relative file paths are used in a CANoe/CANalyzer configuration *.CFG?
Answer:
Basically, in a *.CFG file the paths to referenced files (e.g. CAPL files, databases,...) are stored relative to the location of the *.CFG. Given that the file is referenced from the very same drive letter as the *.CFG file itself — i.e. if you set up the structure of your project with the *.CFG being at the "root" folder and reference all contained files from this directories content — you can also move the whole project directory to another location and CANoe/CANalyzer will find the files.
E.g. CANSystemDemo project folder from CANoe's sample configurations:
Note:
- The file paths visible (compare screenshot below) inside CANoe/CANalyzer when inspecting the configuration will reflect the path based on the location of the *.CFG file - so they will be shown as the absolute path - but internally the path may be saved as relative.
- If the files are on a different drive (letter) than the *.CFG file the paths are persisted as absolute.
E.g. a CAPL file is on f: while the *.CFG is on d:. Then the storage path to the CAPL file is persisted as an absolute path in the *.CFG.
So, after moving the project directory to target PC CANoe/CANalyzer will look for the file at the absolute path of the source PC (on the f: drive). So, the file has to be available on the target PC on the very same absolute path as well. - If you want to change the path to a specific file (e.g. if the file path is not available on the target PC) you can search for and configure it from a different path on the target PC. Such changes can be persisted in the *.CFG via saving the configuration.