Skip to content
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

Do not list devices with a zero size #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions core/systems/frzr/frzr.gd
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ func get_available_disks() -> Array[Disk]:
if not line.contains("disk"):
continue
var parts := line.split(" ", false, 3)
if parts[2] as int == 0:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The output of lsblk --list -n -o name,type,size,model will show the size along with a unit (e.g. 1G, 0B). This should be updated to match on that pattern, instead of casting to an int.

E.g.

Suggested change
if parts[2] as int == 0:
if parts[2] == "0B":

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! Thanks!

I observed that in GDscript if you pass it a string as int it will remove all non-int characters, is my observation correct? I am unable to replicate the behaviour in Python.

continue
var disk := Disk.new()
disk.name = parts[0]
disk.path = "/dev/" + disk.name
Expand Down