1 | static double diskSpacePercentage_oshi() { |
2 | ret diskSpacePercentage_oshi(userDir()); // default to home partition |
3 | } |
4 | |
5 | static double diskSpacePercentage_oshi(File f) { |
6 | OSFileStore fs = oshi_findFileStore(f); |
7 | if (fs == null) { // default to non-oshi |
8 | long total = f.getTotalSpace(); |
9 | long usable = f.getUsableSpace(); |
10 | ret doubleRatio(total-usable, total); |
11 | } |
12 | |
13 | long total = fs.getTotalSpace(); |
14 | long usable = fs.getUsableSpace(); |
15 | long total2 = fs.getTotalInodes(); |
16 | long usable2 = fs.getFreeInodes(); |
17 | |
18 | ret max(doubleRatio(total-usable, total), |
19 | total2 <= 0 ? 0 : doubleRatio(total2-usable2, total2))*100; |
20 | } |
Began life as a copy of #1014297
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, nazvggbglmsf, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1023142 |
Snippet name: | diskSpacePercentage_oshi - return % full of partition (including inodes) |
Eternal ID of this version: | #1023142/5 |
Text MD5: | 5d5950a00b020742a860deb220e77b61 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-05-15 15:32:41 |
Source code size: | 652 bytes / 20 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 281 / 331 |
Version history: | 4 change(s) |
Referenced in: | [show references] |