Currently we provide a single method fileExists which checks whether a given file path exists. This method can be used to check both if a file and if a directory exists. In case the method is used to check whether a directory exists it looks out of place, for example:
if (!fileExists(fontDirectory)) {
mkdir(fontDirectory);
}
To improve this we should split the current fileExists method into a fileExists and a directoryExists method, which should be disjunct (exclude each other). More specific if a directory path is passed to fileExists and if a file is passed to directoryExists the methods should throw an error.
Currently we provide a single method
fileExists
which checks whether a given file path exists. This method can be used to check both if a file and if a directory exists. In case the method is used to check whether a directory exists it looks out of place, for example:To improve this we should split the current
fileExists
method into afileExists
and adirectoryExists
method, which should be disjunct (exclude each other). More specific if a directory path is passed tofileExists
and if a file is passed todirectoryExists
the methods should throw an error.For more details see also https://github.com/PhoenicisOrg/scripts/pull/1116#discussion_r322902989