Open DavidVorick opened 6 years ago
Could you clarify what you mean by "gracefully handle"? I think the code that uses the path should handle the invalid path because there is no guarantee that just because the path existed while calling abs(...)
it will continue to exist until actually using the path.
Siac has an
abs(dir string)
function which converts a relative path into an absolute path. First, this is a bad name for a function that operates widely in a package, we should change the name of the function to beabsolutePath(dir string)
Second, the
abs
function does not gracefully handle being run in a directory that does not exist. A terminal can end up in a directory that doesn't exist if another program deletes the directory while the terminal iscd
'd into that directory. We need to clean up theabs
function so that it gracefully handles being in a non-existent directory.