0

I know that we can include related file with #include "filepath" . However, I want to create the file path on runtime rather than hard coding it. Passing the file path as string is not working I/O error . Am I missing something?

1 Answers1

1

So you might choose $.evalFile ( somePath )

like var myBaseUri = Folder.userData //(for exemple ) $.evalFile ( File ( myBaseUri+"/myLib.jsx" ) );

Loic
  • 2,173
  • 10
  • 13
  • Thanks for helping, I have tried that too. I'm trying to structure my code w.r.t Common.js standard. So I can move away from #include to require("file"). I'm doing it, by creating require() as global function and If I use $.evalFile I can't get the script to get loaded in the global space (as the returned values will be in function scope). app.doScript cannot be used on the same grounds. – Narendran Sundaram Sep 07 '16 at 06:53
  • I see. But why would you enclose your external file within a function scope if you intend to use it globally ? Why don't you just load the file at the global level at start ? – Loic Sep 07 '16 at 07:55
  • I'm trying to extend jasmine for extended scripts. Hence I want a function to evaluate and load JSX files to global scope. – Narendran Sundaram Sep 07 '16 at 10:31