Add checks that outputs are writable & inputs exist if outputting to or reading from a directory #32
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
Thanks for creating fastspar, very useful and easy to use!
I was having some trouble with writing/reading from files that are in a directory different from where fastspar was run because the directory paths either didn't exist or had typos in them. I added a bunch of simple checks to deal with this. These checks do the following:
fastsparwill now check if the output for --correlation or --covariance is in a directory (path contains a '/') and exit with an error message if the directory (path stripped of all characters after the last '/') doesn't exist or isn't accessible. Previously the program ran fine without errors but didn't produce any output.fastspar_bootstrapwill check if --prefix is in a directory and exit if that directory doesn't exist. Previously the program produced a segmentation fault if this was the case.fastspar_pvalueschecks performs the same check as 1. for --outfile, and the same check as 2. for --prefix. Previously errors in --outfile caused the program to run fine but produce output, and errors in --prefix resulted in a slightly misleading error message about not having the correct number files in the folder.The checks for the directory use <dirent.h> which is not available on windows systems, so I wrapped the relevant code in a preprocessor directive which removes it when compiling on windows.