Default project activation via Pkg.jl or DrWatson.jl

mocalvao
Mon, 06 Feb 2023 18:33:22 +0000
General Usage

Right now my, I have several directories, which have Project.toml files because of 2 situations:
(1) I have cloned them from Github repos, or
(2) I have created them myself as DrWatson.jl “scientific” projects.

In order to have the corresponding environments automatically loaded when I launch Julia, I created a startup.jl file reading:

using OhMyREPL
using DrWatson
if isfile("Project.toml") && isfile("Manifest.toml")
    quickactivate(".")
end

It works ok for the case (2) above, but I would like to contemplate case (1) as well, where the command quickactivate is not relevant (despite not issuing any errors…); in this case (1) I guess I would like to run something like

using Pkg
activate(".")

Which conditional should I test to contemplate this case (1)? It seems the Project.toml file does not have a variable name set instead of what happens in case (2) with the DrWatson projects…

How should I check this and change my startup.jl file accordingly? I hope I have been clear, but am not sure…
Thanks in advance.

9 posts - 4 participants