I just did that for you:
[pre]in IDE:
main.prg Sys(16) |C:\USERS\OLAF\DOCUMENTS\VISUAL FOXPRO PROJECTS\TESTS\SYS16\PRGS\MAIN.FXP
main.prg Sys(16,0) |C:\USERS\OLAF\DOCUMENTS\VISUAL FOXPRO PROJECTS\TESTS\SYS16\PRGS\MAIN.FXP
myapp INIT Sys(16) |PROCEDURE MYAPP.INIT C:\USERS\OLAF\DOCUMENTS\VISUAL FOXPRO PROJECTS\TESTS\SYS16\LIBS\SYSTEM.VCT
myapp INIT Sys(16,0)|C:\USERS\OLAF\DOCUMENTS\VISUAL FOXPRO PROJECTS\TESTS\SYS16\PRGS\MAIN.FXP
in EXE:
main.prg Sys(16) |C:\USERS\OLAF\DOCUMENTS\VISUAL FOXPRO PROJECTS\TESTS\SYS16\HERE.EXE
main.prg Sys(16,0) |C:\USERS\OLAF\DOCUMENTS\VISUAL FOXPRO PROJECTS\TESTS\SYS16\HERE.EXE
myapp INIT Sys(16) |PROCEDURE MYAPP.INIT C:\USERS\OLAF\DOCUMENTS\VISUAL FOXPRO PROJECTS\TESTS\SYS16\LIBS\SYSTEM.VCT
myapp INIT Sys(16,0)|C:\USERS\OLAF\DOCUMENTS\VISUAL FOXPRO PROJECTS\TESTS\SYS16\HERE.EXE[/pre]
The file composition of my little Here.PJX test project can be read from this test output. Just notice myapp is a class within the system.vcx I instanciate as goApp. All output after | is from the SYS function described before the |.
The diversity of output can be coped with by either doing SYS(16) in main.prg only and saving the result in a globally available property or at any later stage doing SYS(16,0), as the main.fxp is always on the stack, that result is constant throughout the whole app lifeycycle and called from any place.
Removing the pain of the PROCEDURE part before the output path by doing SYS(16,0) only we get to:
[pre]in IDE:
main.prg Sys(16,0) |C:\USERS\OLAF\DOCUMENTS\VISUAL FOXPRO PROJECTS\TESTS\SYS16\PRGS\MAIN.FXP
myapp INIT Sys(16,0)|C:\USERS\OLAF\DOCUMENTS\VISUAL FOXPRO PROJECTS\TESTS\SYS16\PRGS\MAIN.FXP
in EXE:
main.prg Sys(16,0) |C:\USERS\OLAF\DOCUMENTS\VISUAL FOXPRO PROJECTS\TESTS\SYS16\HERE.EXE
myapp INIT Sys(16,0)|C:\USERS\OLAF\DOCUMENTS\VISUAL FOXPRO PROJECTS\TESTS\SYS16\HERE.EXE[/pre]
Now we can take JUSTPATH:
[pre]in IDE:
main.prg Justpath(Sys(16,0)) |C:\USERS\OLAF\DOCUMENTS\VISUAL FOXPRO PROJECTS\TESTS\SYS16\PRGS
myapp INIT Justpath(Sys(16,0))|C:\USERS\OLAF\DOCUMENTS\VISUAL FOXPRO PROJECTS\TESTS\SYS16\PRGS
in EXE:
main.prg Justpath(Sys(16,0)) |C:\USERS\OLAF\DOCUMENTS\VISUAL FOXPRO PROJECTS\TESTS\SYS16
myapp INIT Justpath(Sys(16,0))|C:\USERS\OLAF\DOCUMENTS\VISUAL FOXPRO PROJECTS\TESTS\SYS16[/pre]
If you move your main.prg into the PJX folder:
[pre]in IDE:
main.prg Justpath(Sys(16,0)) |C:\USERS\OLAF\DOCUMENTS\VISUAL FOXPRO PROJECTS\TESTS\SYS16
myapp INIT Justpath(Sys(16,0))|C:\USERS\OLAF\DOCUMENTS\VISUAL FOXPRO PROJECTS\TESTS\SYS16
in EXE:
main.prg Justpath(Sys(16,0)) |C:\USERS\OLAF\DOCUMENTS\VISUAL FOXPRO PROJECTS\TESTS\SYS16
myapp INIT Justpath(Sys(16,0))|C:\USERS\OLAF\DOCUMENTS\VISUAL FOXPRO PROJECTS\TESTS\SYS16[/pre]
Now all outputs are the same. The other way to keep main.prg in the prgs subfolder is removing the \PRGS part when in IDE, by doing JUSTPATH once more when _VFP.Startmode=0. The adjustment differs with where you put your main.prg in your project directory structure. So there is no general rule and code for that, but you only need to cope with it in the IDE.
In any case, David, your LEFT(SYS(16),3) done in a main.prg will always be the correct drive letter. LEFT(SYS(16,0),3) also, unless you make an SCX your main project file. But who does that? We all know the concept of a main.prg
In the end Justpath(Sys(16,0)) is very surely giving you the path of your EXE done anywhere in any code in the executable and within your IDE you may get the same path, if you decide to put your main.prg there, too, or you adjust it for that case.
Bye, Olaf.