Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

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?

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.

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!

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).

There are 0 guests and 0 other users also viewing this topic