2

Is there a way to access a solution or project path variable (ex. "c:/path/to/solution/project/") inside the model.js file?

The following options do NOT work inside model.js:

File("/PROJECT/path/to/file/inside/project.js");
getFolder("path");
ds.getModelFolder();
Stefan
  • 425
  • 2
  • 8

2 Answers2

3

If you put that code inside an event, a method etc.. yes it should work.

But when you put it in the global scope, you should pay attention that the studio will evaluate your script to check if you have defined any methods, events etc.. and the methods getFolder and ds.getModelFolder are not always available on the global scope.

This also means that requiring modules located in the project's modules folder from the global scope will cause an error as well (but requiring a module using relative path should work)

Work is being done to make using filesystems inside the model.js file possible (/PROJECT/..)

hamzahik
  • 714
  • 4
  • 7
0

You can access the solution path inside model.js by using the following :

var solPath = solution.getFolder().path ;
issam Eljohri
  • 322
  • 1
  • 6