You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
lake: __dir__ contains relative path, that is cached and becomes wrong when using -d=.. flag #7498
__dir__ provided by lake when running from the package's root is ./.. When running from a subdirectory using -d=.., __dir__ is ../.. If running again without changing lakefile and without -R, __dir__ doesn't change regardless of cwd or -d=. As I understand, this is because it is stored in lakefile.olean.
Context
Steps to Reproduce
Create a project
To lakefile add:
script myScript do
IO.println __dir__
return 0
From the package's root, run: lake run myScript
From a subdirectory run lake run -d=.. myScript
From the same subdirectory run lake run -R -d=.. myScript
Expected behavior:
Output contains paths to the package's directory.
Actual behavior:
Second path is invalid (it is a relative path, that is correct only when starting from the package's root).
Third path is valid, because -R triggers re-elaboration.
Versions
"4.18.0-rc1"
Linux 6.12.6-100.fc40.x86_64
Additional Information
I think it can be fixed by using IO.FS.realPath in Lake.DSL.elabDirConst.
Activity
feat: lake: use absolute paths (#7822)