Skip to content

Commit

Permalink
Merge pull request #5 from ath0mas/statfs-deprecated
Browse files Browse the repository at this point in the history
Android: replace deprecated StatFs functions
  • Loading branch information
ath0mas authored Aug 30, 2023
2 parents f53f21b + 68856d5 commit 60212b2
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/android/DirectoryManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ public static long getFreeExternalStorageSpace() {
public static long getFreeSpaceInBytes(String path) {
try {
StatFs stat = new StatFs(path);
long blockSize = stat.getBlockSize();
long availableBlocks = stat.getAvailableBlocks();
return availableBlocks * blockSize;
return stat.getAvailableBytes();
} catch (IllegalArgumentException e) {
// The path was invalid. Just return 0 free bytes.
return 0;
Expand Down

0 comments on commit 60212b2

Please sign in to comment.