NebulousLabs / Sia

Blockchain-based marketplace for file storage. Project has moved to GitLab: https://gitlab.com/NebulousLabs/Sia

Home Page:https://sia.tech

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Siac Absolute Filepath

DavidVorick opened this issue · comments

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 be absolutePath(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 is cd'd into that directory. We need to clean up the abs function so that it gracefully handles being in a non-existent directory.

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.