Comments (34)
Renamed to clarify cause
from about-this-hack.
Oh no I'm sorry there is indeed a storage issue.
from about-this-hack.
See if you can run this @frogg
egrep "[Container|Volume] Total Space:" "/tmp/.ath/sysvolname.txt" | awk '{print $4,$5}'
Let me know what is printed
from about-this-hack.
Ok I have made a potential fix, do try this and let me know if it works for you:
https://www.mediafire.com/file/b431dfoa8mramfi/About+This+Hack.zip/file
from about-this-hack.
See if you can run this @frogg
egrep "[Container|Volume] Total Space:" "/tmp/.ath/sysvolname.txt" | awk '{print $4,$5}'
Let me know what is printed
Output: 2.0 TB
from about-this-hack.
Try with a conversion to the same unit (GB) of size on Disk total size and Available total size
(don't copy lines below, github view didn't return editor real edited code)
Not tested (I don't have N TB SSD)
HardwareCollector.swift
...
static func getStorageData() -> [String] {
...
let size = run("egrep "[Container|Volume] Total Space:" | awk '{print $4,$5}' | tr -d '\n'")
var coeffMultDiskSIze = 1.0
switch run("echo "(size)" | awk '{print $2}' | tr -d '\n'") {
case "GB" : coeffMultDiskSIze = 1
case "MB" : coeffMultDiskSIze = 0.1
case "TB" : coeffMultDiskSIze = 10
default : coeffMultDiskSIze = 1
}
let sizeTrimmed = (Double(run("echo "(size)" | awk '{print $1}' | tr -d '\n'"))! * Double(coeffMultDiskSIze))
let available = run("grep \"[Container|Volume] Free Space:\" | awk '{print $4,$5}' | tr -d '\n'")
var coeffMultAvailableSIze = 1.0
switch run("echo \"\(available)\" | awk '{print $2}' | tr -d '\n'") {
case "GB" : coeffMultAvailableSIze = 1
case "MB" : coeffMultAvailableSIze = 0.1
case "TB" : coeffMultAvailableSIze = 10
default : coeffMultAvailableSIze = 1
}
let availableTrimmed = (Double(run("echo \"\(available)\" | awk '{print $2}' | tr -d '\n'"))! * Double(coeffMultAvailableSIze))
let percentfree = NSString(format: "%.2f",(availableTrimmed) / sizeTrimmed * 100)
...
Regards
from about-this-hack.
I have implemented a similar fix in the mediafire document attached above ; @frogg if you could test that it would be awesome :)
from about-this-hack.
with a fake 2 TB HDD (External USB SSD) test with 2 TB forced in code
with my real 250 GB (External USB SSD) test with real app. code
with a fake 128 MB HDD (External USB SSD) test with 128 MB forced in code
...
// let size = run("egrep "[Container|Volume] Total Space:" " + initGlobVar.bootvolnameFilePath + " | awk '{print $4}' | tr -d '\n'")
// let unitsize = run("egrep "[Container|Volume] Total Space:" " + initGlobVar.bootvolnameFilePath + " | awk '{print $5}' | tr -d '\n'")
// let size = "2.0" //test code
// let unitsize = "TB" //test code
let size = "128.0" //test code
let unitsize = "MB" //test code
var coeffMultDiskSize = 1.0
switch unitsize {
case "GB" : coeffMultDiskSize = 1.0
case "MB" : coeffMultDiskSize = 0.001
case "TB" : coeffMultDiskSize = 1000.0
default : coeffMultDiskSize = 1.0
}
let sizeTrimmed = (Double(size)! * coeffMultDiskSize)
print(coeffMultDiskSize)
// let available = run("grep "[Container|Volume] Free Space:" " + initGlobVar.bootvolnameFilePath + " | awk '{print $4}' | tr -d '\n'")
// let unitavailable = run("grep "[Container|Volume] Free Space:" " + initGlobVar.bootvolnameFilePath + " | awk '{print $5}' | tr -d '\n'")
// let available = "227.43" //test code
// let unitavailable = "GB" //test code
let available = "62.73" //test code
let unitavailable = "MB" //test code
var coeffMultAvailableSize = 1.0
switch unitavailable {
case "GB" : coeffMultAvailableSize = 1.0
case "MB" : coeffMultAvailableSize = 0.001
case "TB" : coeffMultAvailableSize = 1000.0
default : coeffMultAvailableSize = 1.0
}
let availableTrimmed = (Double(available)! * coeffMultAvailableSize)
print(coeffMultAvailableSize)
let percent = (availableTrimmed / sizeTrimmed)
let percentfree = NSString(format: "%.2f",(availableTrimmed) / sizeTrimmed * 100)
print("Size: Double(\(sizeTrimmed))")
print("Available: Double(\(availableTrimmed))")
print("%: \(percentfree)")
return ["""
\(name) (\(devicelocation) \(deviceprotocol))
\(size) \(unitsize) (\(available) \(unitavailable) Available - \(percentfree)%)
""", String(1 - percent)]
}
Regards
from about-this-hack.
@matxpa Have you tried with the app I have uploaded ? Thank you for the rest though.
from about-this-hack.
https://www.mediafire.com/file/b431dfoa8mramfi/About+This+Hack.zip/file
from about-this-hack.
I couldn't launch the app. you UpLoaded yesterday and nor this one above
from about-this-hack.
Interesting - I will implement your fix then, since you have tested it already. Will then push. Thanks
from about-this-hack.
Will keep you updated.
from about-this-hack.
Yes but let me set this fix in my Repo (main branch)
from about-this-hack.
The only thing I would change in your code is obtaining the unit - better to pull it from the first shell string to optimize time spent.
let unit = size[size.length-2]
extension String {
var length: Int {
return count
}
subscript (i: Int) -> String {
return self[i ..< i + 1]
}
func substring(fromIndex: Int) -> String {
return self[min(fromIndex, length) ..< length]
}
func substring(toIndex: Int) -> String {
return self[0 ..< max(0, toIndex)]
}
subscript (r: Range<Int>) -> String {
let range = Range(uncheckedBounds: (lower: max(0, min(length, r.lowerBound)),
upper: min(length, max(0, r.upperBound))))
let start = index(startIndex, offsetBy: range.lowerBound)
let end = index(start, offsetBy: range.upperBound - range.lowerBound)
return String(self[start ..< end])
}
}
from about-this-hack.
@MDNich
I've pushed this code (without your fix above) in HardwareCollector.swift in my Repo (main branch) so get and keep what you need
from about-this-hack.
Merged, thank you. I also adjusted slightly the notation with the optimization I mentioned.
@frogg, if you could test the release tag I'm about to attach here, if it works we can make it as finished.
from about-this-hack.
Yes and the 2 last sent issues (#62 #63) seem to be same as #60 one
from about-this-hack.
Either compile from source with tag storage-test-1 https://github.com/0xCUB3/About-This-Hack/releases/tag/storage-test-1
or with the compiled binary below: https://www.mediafire.com/file/y2v7fimnb68d3lz/About+This+Hack.zip/file
from about-this-hack.
@matxpa lets keep this one for the display, and I merged 62,63 > 60.
from about-this-hack.
Thanks for your help :)
from about-this-hack.
With your About-This-Hack-storage-test-1 built with Xcode 14.2 (Monterey) (Xcode 15.0 Ventura or Sonoma debug can't work)
I'll try with forced values TB and MB (MB for the fun)
Regards
from about-this-hack.
Ok looks good yes ?
from about-this-hack.
sorry I don't have Xcode 12.5 like 0xCUB3, just Sonoma
from about-this-hack.
With forced size to "2.0 TB" and available to "216.47 GB"
Just remove (unit)B and (unitA)B in returned array
return ["""
(name) ((devicelocation) (deviceprotocol))
(size) (unit)B ((available) (unitA)B Available - (percentfree)%)
""", String(1 - percent)]
and also var sizeTrimmed to let sizeTrimmed
.../About-This-Hack-storage-test-1/About This Hack/HardwareCollector.swift:126:13 Variable 'sizeTrimmed' was never mutated; consider changing to 'let' constant
Did you apply the first commit in my Repo (main branch) commit concerning SIP returned value when SIP is enabled
from about-this-hack.
That's my bad - I wrote exactly what you wrote, but the size
and available
already include the unit. Fixed in this push.
from about-this-hack.
https://www.mediafire.com/file/prqoarm95ppn0jr/About+This+Hack.zip/file @frogg
from about-this-hack.
With the app. above
from about-this-hack.
"Did you apply the first commit in my Repo (main branch) commit concerning SIP returned value when SIP is enabled"
I apologize, yes you did, I can see it in the proj you sent and in the App. above
from about-this-hack.
Hi all
This issue isn't fixed ?
Regards
from about-this-hack.
Waiting on @frogg to test before closing.
from about-this-hack.
Ok
from about-this-hack.
@frogg you there?
from about-this-hack.
closing issue because of inactivity; assuming fixed
from about-this-hack.
Related Issues (20)
- Display Bug HOT 31
- App crashes immediately after launch HOT 5
- Immediate crash after opening HOT 1
- App update function not working HOT 1
- App crashes when clicking on "Displays" HOT 2
- No displays info - v1.0.0 HOT 24
- Display Preferences button does nothing HOT 3
- "Bootloader" section says "Apple UEFI" if Clover is used as a Bootloader HOT 4
- "Software Update..." not properly redirecting HOT 12
- Crashing when clicking on "Displays" HOT 21
- I think the inbuilt-updater hasn't been fixed yet? HOT 1
- When I click on Hackintosh Guide it opens Apple Help Home page HOT 5
- GPU and Displays do not appear HOT 6
- Reporting a model name issue HOT 2
- Cannot install on Windows HOT 1
- There is no image on Storage tab HOT 6
- The latest version is 404:NotFound. You are currently running 1.2.0. HOT 3
- ATH v1.1.1 Update HOT 4
- Code signature changed? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from about-this-hack.