How to retrieve the filepath of a model

Hello forum!

I read the following thread which helps a lot.

Unfortunately, I can't get the path of the current model.

I tried the following code samples, but I wasn't able to get the path of the smodel or rather the suitable method.


Has someone an idea?

Comment actions Permalink

model m = ...;

#print m/.getSource().getLocation()

This will give you the path to the .mps file. If you want to have the path to the folder you could use

#print new File(m/.getSource().getLocation()).getParent();

Comment actions Permalink

Thanks Alexander! Works as expected for me.


Please sign in to leave a comment.