Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: run! errors if output is a standalone file #4

Closed
wants to merge 1 commit into from
Closed

fix: run! errors if output is a standalone file #4

wants to merge 1 commit into from

Conversation

storopoli
Copy link
Contributor

Right now the run! function errors on the README instructions.

The idea here is to add an if to check it the dirname of the joinpath(pwd(), output) is a dir instead of throwing error straight away.

Right now the `run!` function errors on the README instructions.

The idea here is to add an `if` to check it the `dirname` of the `joinpath(pwd(), output)` is a dir instead of throwing error straight away.
Copy link

codecov bot commented Jan 10, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (ce494f5) 83.98% compared to head (958b76d) 83.51%.
Report is 1 commits behind head on main.

Files Patch % Lines
src/server.jl 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main       #4      +/-   ##
==========================================
- Coverage   83.98%   83.51%   -0.47%     
==========================================
  Files           5        5              
  Lines         356      358       +2     
==========================================
  Hits          299      299              
- Misses         57       59       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@MichaelHatherly MichaelHatherly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @storopoli. A test case to cover this one would be great too.

Comment on lines 100 to 107
function _check_output_dst(s::AbstractString)
dir = dirname(s)
isdir(dir) || throw(ArgumentError("directory does not exist: $(dir)"))
if !isdir(dir)
_dir = dirname(joinpath(pwd(), s))
isdir(_dir) || throw(ArgumentError("directory does not exist: $(dir)"))
end
return nothing
end
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
function _check_output_dst(s::AbstractString)
dir = dirname(s)
isdir(dir) || throw(ArgumentError("directory does not exist: $(dir)"))
if !isdir(dir)
_dir = dirname(joinpath(pwd(), s))
isdir(_dir) || throw(ArgumentError("directory does not exist: $(dir)"))
end
return nothing
end
function _check_output_dst(s::AbstractString)
s = abspath(s)
dir = dirname(s)
isdir(dir) || throw(ArgumentError("directory does not exist: $(dir)"))
return nothing
end

is probably sufficient.

@MichaelHatherly
Copy link
Collaborator

Replaced by #5, thanks @storopoli.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants