Skip to content

Commit 53ac0a7

Browse files
authored
Merge pull request #1 from naxel/FSInfo-added-information-about-sdcard
Added to FSInfoResult object information about sdcard
2 parents 3076979 + c675afe commit 53ac0a7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

android/src/main/java/com/rnfs/RNFSManager.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,11 +866,16 @@ public void pathForGroup(String bundleNamed, Promise promise) {
866866
public void getFSInfo(Promise promise) {
867867
File path = Environment.getDataDirectory();
868868
StatFs stat = new StatFs(path.getPath());
869+
StatFs statEx = new StatFs(Environment.getExternalStorageDirectory().getPath());
869870
long totalSpace;
870871
long freeSpace;
872+
long totalSpaceEx = 0;
873+
long freeSpaceEx = 0;
871874
if (android.os.Build.VERSION.SDK_INT >= 18) {
872875
totalSpace = stat.getTotalBytes();
873876
freeSpace = stat.getFreeBytes();
877+
totalSpaceEx = statEx.getTotalBytes();
878+
freeSpaceEx = statEx.getFreeBytes();
874879
} else {
875880
long blockSize = stat.getBlockSize();
876881
totalSpace = blockSize * stat.getBlockCount();
@@ -879,6 +884,8 @@ public void getFSInfo(Promise promise) {
879884
WritableMap info = Arguments.createMap();
880885
info.putDouble("totalSpace", (double) totalSpace); // Int32 too small, must use Double
881886
info.putDouble("freeSpace", (double) freeSpace);
887+
info.putDouble("totalSpaceEx", (double) totalSpaceEx);
888+
info.putDouble("freeSpaceEx", (double) freeSpaceEx);
882889
promise.resolve(info);
883890
}
884891

0 commit comments

Comments
 (0)