diff --git a/src/packmol_runner.jl b/src/packmol_runner.jl index f3b05c8..d7e7118 100644 --- a/src/packmol_runner.jl +++ b/src/packmol_runner.jl @@ -1,5 +1,4 @@ import Packmol_jll -import NativeFileDialog packmol_runner = Packmol_jll.packmol() @@ -51,12 +50,6 @@ function run_packmol(input_file::String) return nothing end -@doc (@doc run_packmol) -function run_packmol() - input_file = NativeFileDialog.pick_file() - run_packmol(input_file) -end - @testitem "run_packmol" begin using Packmol test_dir = Packmol.src_dir*"/../test/run_packmol" @@ -70,4 +63,18 @@ end @test isfile("water_box.pdb") end - +@static if haskey(ENV, "PACKMOL_GUI") && ENV["PACKMOL_GUI"] == "false" + function run_packmol() + throw(ArgumentError("""\n + Environment variable PACKMOL_GUI is set to false. Set it to true to use the file dialog. + + """)) + end +else + import NativeFileDialog + @doc (@doc run_packmol) + function run_packmol() + input_file = NativeFileDialog.pick_file() + run_packmol(input_file) + end +end \ No newline at end of file