In Julia documentation, it is said that to determine that a file is run as the main script, one can check if abspath(PROGRAM_FILE) == @__FILE__
is true
. When directly running the file, this works fine. However, when debugging in VS Code using the Julia extension, the value of PROGRAM_FILE
changes to /Users/my_user_name/.vscode/extensions/julialang.language-julia-1.5.8/scripts/debugger/run_debugger.jl
, i.e. the path to the debugger.
So my question is: how to check if the current file is “main” when debugging (in VS Code)?
Further information:
- OS: macOS Monterey 12.0.1 (21A559)
- VS Code: version 1.62.3 (Commit ccbaa2d27e38e5afa3e5c21c1c7bef4657064247)
- Julia installation: version 1.7.1
- Julia extension: version 1.5.8