How can a document loaded in startup.scd know it's own location?

Hi!

If in startup.scd I do

"myfile.scd".load;

and inside myfile.scd I try access Document.current.dir but it gives me nil.

The same file opened in scide does give the right dir when evaluating that line. I assume the reason is that the file is not actually open in the IDE when loaded from the startup file, but just in memory somehow.

Can I somehow figure out from which directory myfile.scd was loaded from when loaded via startup.scd?

try thisProcess.nowExecutingPath

1 Like

Thank you! That’s what I needed :slight_smile: To get the path only I can do

PathName.new(thisProcess.nowExecutingPath).pathOnly

:slight_smile: