Hello,
I have tested the following to illustrate the different way of path detection:
In the SCD file ‘A.scd’ in a folder:
/*RUN*/
Document.autoRun_(true);
(
(" " + "".quote ++ ".resolveRelative:" + "".resolveRelative).postln; // code 1
"-------------------------------------".postln;
("thisProcess.nowExecutingPath.basename:" + thisProcess.nowExecutingPath.basename).postln; // code 2
(" thisProcess.nowExecutingPath.dirname:" + thisProcess.nowExecutingPath.dirname).postln; // code 3
(" thisProcess.nowExecutingPath:" + thisProcess.nowExecutingPath).postln; // code 4
"-------------------------------------".postln;
(" Document.current.title:" + Document.current.title).postln; // code 5
(" Document.current.dir:" + Document.current.dir).postln; // code 6
(" Document.current.path:" + Document.current.path).postln; // code 7
);
"subfolder/B.scd".loadRelative // code 8
In the SCD file ‘B.scd’ in the subfolder ‘subfolder’ of the above folder:
(
(" " + "".quote ++ ".resolveRelative:" + "".resolveRelative).postln;
"-------------------------------------".postln;
("thisProcess.nowExecutingPath.basename:" + thisProcess.nowExecutingPath.basename).postln;
(" thisProcess.nowExecutingPath.dirname:" + thisProcess.nowExecutingPath.dirname).postln;
(" thisProcess.nowExecutingPath:" + thisProcess.nowExecutingPath).postln;
"-------------------------------------".postln;
(" Document.current.title:" + Document.current.title).postln;
(" Document.current.dir:" + Document.current.dir).postln;
(" Document.current.path:" + Document.current.path).postln;
);
However, the Post window returns when the A.scd file is opened:
ERROR: can't resolve relative to an unsaved file.
Path to resolve: ""
I have tested each of the 8 codes in the ‘A.scd’ file individually. All 8 codes return the same error.
Can the following three codes
thisProcess.nowExecutingPath
Document.current.path
"".resolveRelative
not be used in a document that starts with the following two lines?
/*RUN*/
Document.autoRun_(true);