Setting the working directory to the directory of current open file as default?

Hello,

When I open a Julia file in Atom my working directory is automatically set to my HOME directory. Thus I have to either explicitly code: cd(dirname(@__FILE__)) or use the following command: Julia Client: Work in File Folder. Is there a way to avoid this altogether and make it default behavior? I believe this is similar to the issues #490 and #124 . Yet it seems to have been resolved in issue #124.
When I create the file Example.jl with the following code:

println(pwd())
cd(dirname(@__FILE__))
println(pwd()) 

inside and run it I get the following output in the REPL below:

C:\Users\adurmus
C:\Users\adurmus\Desktop\Folder #1

1 Like

What is the project folder? In other words, when you look at tree view (usually the view of files and folders on the left part of the window) are you seeing all the folders in your home folder or just Folder #1?

So when I open up a julia file in Atom by just double clicking it, no tree view pane shows up. When I select Tree View:Toggle command, a project pane pops up but I am not seeing any folders inside it. Here is a screenshot of what I am seeing:

Try adding a project folder there, or else right-click the folder of the project you’re working on and open it in atom. I’m guessing that because there’s no project folder, Juno is just defaulting to $HOME.

1 Like

It would be nice if there could be some sort of Juno setting that we could select to automatically cd Julia to the directory containing the first-opened file (instead of going Julia -> Working Directory -> Current File’s Folder). It used to work this way before Atom updated to v1.36. I could understand if not everyone wants this behavior, but I think most people would and this should definitely be an option.