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


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:


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

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


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.

Is there a way to launch it with a different default?

If you start with e.g. atom . then Juno should set . as the working dir automatically (given that you don’t have any other project folders open).

Perfect, so at the Juno launcher in JuliaPro I set start "%USERPROFILE%" "app-1.40.1/atom.exe" %JULIADOC% where JULIADOC is where I want it to start.

Well, maybe – I haven’t actually tried this. atom path/do/somewhere will add somewhere as a project folder in Atom, and Juno will start Julia processes in the first project folder by default.

There actually is a better solution though: Fill in the two following entries in julia-clients settings and you should be good to go.

Although Working Directory will be updated if you change the working dir through Juno (e.g. with the Work In File Folder command; cd in Julia doesn’t have an effect though).

Has this been resolved? It seems that $HOME is always the default folder and not the starting folder. This is very counterintuitive…

Ah, found it: Juno->Working Directory->Current File’s Folder

1 Like