-
Notifications
You must be signed in to change notification settings - Fork 1
fix: check free disk space and allow to specify a different download/extraction directory #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Per Tillisch <accounts@perglass.com>
Requested changes have been made. Thanks!
| "github.com/arduino/arduino-flasher-cli/i18n" | ||
| ) | ||
|
|
||
| const GB = uint64(1024 * 1024 * 1024) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const GB = uint64(1024 * 1024 * 1024) | |
| const GiB = uint64(1024 * 1024 * 1024) |
| return nil, err | ||
| } | ||
| if d.Free/GB < NeededDiskSpace { | ||
| return nil, fmt.Errorf("aborting: download and extraction requires up to %d GB of free space", NeededDiskSpace) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return nil, fmt.Errorf("aborting: download and extraction requires up to %d GB of free space", NeededDiskSpace) | |
| return nil, fmt.Errorf("aborting: download and extraction requires up to %d GiB of free space", NeededDiskSpace) |
| if err != nil { | ||
| return nil, fmt.Errorf("could not get user's cache directory: %w", err) | ||
| } | ||
| func GetTempDir(prefix string, tempDir string) (*paths.Path, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is strange, in my opinion, that a function called GetTempDir has a parameter called tempDir. I think we should refactor this to make it cleaner
Motivation
The default download/extraction directory might be on a disk with insufficient space.
Change description
Two changes have been introduced:
--temp-dirflag;Additional Notes
Reviewer checklist
main.