super icon indicating copy to clipboard operation
super copied to clipboard

superman thinks that I have no free space, but I have ~350GB free

Open ofirgalcon opened this issue 1 year ago • 3 comments

SCR-20241125-lmcw

ofirgalcon avatar Nov 25 '24 22:11 ofirgalcon

I found that this in line 4495

[[ "${current_user_account_name}" != "FALSE" ]] && storage_available_gigabytes=$(osascript -l 'JavaScript' -e "ObjC.import('Foundation'); var freeSpaceBytesRef=Ref(); $.NSURL.fileURLWithPath('/').getResourceValueForKeyError(freeSpaceBytesRef, 'NSURLVolumeAvailableCapacityForImportantUsageKey', null); Math.round(ObjC.unwrap(freeSpaceBytesRef[0]) / 1000000000)")

suddenly returns 0 on my system

but

[[ "${current_user_account_name}" != "FALSE" ]] && storage_available_gigabytes=$(osascript -l 'JavaScript' -e "ObjC.import('Foundation'); var freeSpaceBytesRef=Ref(); $.NSURL.fileURLWithPath('/').getResourceValueForKeyError(freeSpaceBytesRef, 'NSURLVolumeAvailableCapacityKey', null); Math.round(ObjC.unwrap(freeSpaceBytesRef[0]) / 1000000000)")

returns 359 (which is correct)

ofirgalcon avatar Nov 25 '24 23:11 ofirgalcon

Well thank you for pin-pointing the specific API call! We should do some sleuthing in the Apple Dev documentation to see if there is a "more correct" call?

Full disclosure, I coppied that specific line from another script... so I (currently) don't have a strong opinion one way or the other.

Macjutsu avatar Nov 25 '24 23:11 Macjutsu

I didn't even know this command existed. I normally just use df but I guess this is more accurate?

ofirgalcon avatar Nov 26 '24 20:11 ofirgalcon