# Starting Julia debugger in a given directory

**URL:** <https://discourse.julialang.org/t/starting-julia-debugger-in-a-given-directory/104282>\
**Category:** VS Code\
**Tags:** debug, debugging, vscode, filesystem\
**Created:** [September 26, 2023, 9:06pm UTC](https://discourse.julialang.org/t/starting-julia-debugger-in-a-given-directory/104282 "2023-09-26T21:06:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wujinq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wujinq/32/22221_2.png) [@wujinq](https://discourse.julialang.org/u/wujinq)\
**Post date:** [September 26, 2023, 9:06pm UTC](https://discourse.julialang.org/t/starting-julia-debugger-in-a-given-directory/104282/1 "2023-09-26T21:06:03Z")

</div>

I’m writing a script that read files in the same folder that contains the script itself. So the script starts with something like

```julia
let wfn_file_name = "WFN_co.h5",
    eqp_file_name = "eqp_co.dat",
    itrs_max = 1

    wfn_fid = h5open(wfn_file_name)
    eqp_fid = open(eqp_file_name)
#...

```

And now I want to debug it. The script is not in the root directory of the current VSCode workspace, which however is set to be the default working directory of Julia debugger in VSCode. Therefore the program fails (pause at exception) the time it reaches `h5open(...)`.

Is there any way to tell the debugger to start in the folder that directly contains my script? Another solution is to let the program stop before `h5open` and then I manually set the working directory using `cd` in DEBUG CONSOLE.

Of course, I can change the `wfn_file_name ` etc. when debugging, but at the risk of forgetting to change them back after debugging; and it’s also very inconvenient.

I think that should be a quite common problem. What are your solutions when you face this simple but annoying issue?

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [September 26, 2023, 10:20pm UTC](https://discourse.julialang.org/t/starting-julia-debugger-in-a-given-directory/104282/2 "2023-09-26T22:20:30Z")

</div>

You can specify paths relative to the file where the code is written using

```julia
joinpath(@ __DIR__ , "other_file_next_to_source.csv")

```

Source: [Essentials · The Julia Language](https://docs.julialang.org/en/v1/base/base/#Base.@ __DIR__ )
