- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » On relative file paths
On relative file paths
On relative file paths
I was creating a small library for personal use, that I don't have to load all the models I use models over and over again.
The problem now is, that I have a model using the CombiTable2D with tableOnFile = true.
Until now I used absolute file path to the table file. But with the library at hand, I wanted to store this table file along the model and make the whole libraray a little bit portable.
I read in another thread, that relative file paths are evil in OpenModelica. But the Modelica Standard Library use relative file paths for all the images inside the documentation, so where is the problem doing the same with a table.txt file?
- MProp
- 14 Posts
Re: On relative file paths
The MSL uses no relative file paths for images inside the documentation. They use modelica:// links. And you can use modelica:// links using the loadResource function in MSL to do the same for a table.txt.
- sjoelund.se
- 1700 Posts
Re: On relative file paths
Wow, thanks. Now I understand.
But why can pictures be accessed directly via modelica:// links and other files can not?
However THANK YOU!
- MProp
- 14 Posts
Re: On relative file paths
Mostly because that's what the Modelica specification says you should do that for pictures. And C89 fopen does not know about modelica://, so you need to fix the paths before you call external "C" functions (which is the only way to read files in Modelica).
- sjoelund.se
- 1700 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » On relative file paths