Browse Source

Apply fix to #302 IOS fs.df issue

Ben Hsieh 7 years ago
parent
commit
f8097532b5
1 changed files with 3 additions and 6 deletions
  1. 3
    6
      ios/RNFetchBlobFS.m

+ 3
- 6
ios/RNFetchBlobFS.m View File

748
 
748
 
749
 +(void) df:(RCTResponseSenderBlock)callback
749
 +(void) df:(RCTResponseSenderBlock)callback
750
 {
750
 {
751
-    uint64_t totalSpace = 0;
752
-    uint64_t totalFreeSpace = 0;
753
     NSError *error = nil;
751
     NSError *error = nil;
754
     NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
752
     NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
755
     NSDictionary *dictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths lastObject] error: &error];
753
     NSDictionary *dictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths lastObject] error: &error];
757
     if (dictionary) {
755
     if (dictionary) {
758
         NSNumber *fileSystemSizeInBytes = [dictionary objectForKey: NSFileSystemSize];
756
         NSNumber *fileSystemSizeInBytes = [dictionary objectForKey: NSFileSystemSize];
759
         NSNumber *freeFileSystemSizeInBytes = [dictionary objectForKey:NSFileSystemFreeSize];
757
         NSNumber *freeFileSystemSizeInBytes = [dictionary objectForKey:NSFileSystemFreeSize];
760
-        totalSpace = [fileSystemSizeInBytes unsignedLongLongValue];
761
-        totalFreeSpace = [freeFileSystemSizeInBytes unsignedLongLongValue];
758
+        
762
         callback(@[[NSNull null], @{
759
         callback(@[[NSNull null], @{
763
-                  @"free" : [NSNumber numberWithUnsignedLongLong: totalFreeSpace],
764
-                  @"total" : [NSNumber numberWithUnsignedLongLong: totalSpace],
760
+                  @"free" : freeFileSystemSizeInBytes,
761
+                  @"total" : fileSystemSizeInBytes,
765
                 }]);
762
                 }]);
766
     } else {
763
     } else {
767
         callback(@[@"failed to get storage usage."]);
764
         callback(@[@"failed to get storage usage."]);