swiftly icon indicating copy to clipboard operation
swiftly copied to clipboard

If `~/.local/bin` folder doesn't exist `use` fails to setup symbolic links

Open adam-fowler opened this issue 2 years ago • 2 comments

There are too many places in the code base at the moment where errors are not caught and dealt with. The use function would throw an error and then that was it. We should catch this and create the folder.

adam-fowler avatar Mar 05 '23 19:03 adam-fowler

SWIFTLY_BIN_DIR, SWIFTLY_HOME_DIR, and SWIFTLY_HOME_DIR/toolchains are all created by each command before it runs if they don't exist, see here: https://github.com/patrickfreed/swiftly/blob/main/Sources/Swiftly/Swiftly.swift#L47. Can you share the error you were seeing / steps to reproduce it?

patrickfreed avatar Mar 20 '23 04:03 patrickfreed

I cannot remember anymore how I got this. It is kinda moot when running from the script as it sticks swiftly inside the ~/.local/bin folder. So the folder will always exist. But I do think we should be catching unexpected errors and trying to provided a readable error message from them.

adam-fowler avatar Mar 20 '23 10:03 adam-fowler