0
Create Xcos block with string parameter

Hi,

I'm developing a toolbox for Xcos using C source code (using the xcos toolbox squeleton in the source code of scilab as a reference). The code for one block needs a configuration file. I tried to access this configuration file with a relative path in the source code. The problem is that the execution path depends on the folder that the console shows, i.e., if I use cd [path] in the console, the execution path of the block in the simulation changes and the c code in the block will fail to open the configuration file with the relative path.

In other block I was able to overcome this issue using some functions in the library code to get the path of the library itself. This way the configuration file, that is in the same folder as the library, will be open without a problem. The thing is that this solution is not possible in the new block I want to create. I though about using a parameter of the block to get the path for the configuration file but there is no way to use strings in the parameters.

┬┐Any suggestion about a workaround or idea to solve this problem?


Scilab 14-02-19, 2:53 p.m. dagomar
0

Well if the directory structure is going to remain the same and the files are not going to be moving around, you may consider using relative paths. Relative to the main script that triggeres the process, you may hardcode paths of other files. For example, if you know some file is two directories above, you may write "../../filename" this will not change the current directory.

I hope I have understood your question and the reply is helpful.

26-12-19, 1:15 p.m. rupakrokade


Log-in to answer to this question.