mirror of
https://github.com/status-im/react-native-fs.git
synced 2025-03-01 07:20:33 +00:00
Add tmp path
This commit is contained in:
parent
01d43a011a
commit
7bf7c0bca1
@ -196,6 +196,7 @@ var RNFS = {
|
|||||||
CachesDirectoryPath: RNFSManager.NSCachesDirectoryPath,
|
CachesDirectoryPath: RNFSManager.NSCachesDirectoryPath,
|
||||||
DocumentDirectoryPath: RNFSManager.NSDocumentDirectoryPath,
|
DocumentDirectoryPath: RNFSManager.NSDocumentDirectoryPath,
|
||||||
ExternalDirectoryPath: RNFSManager.NSExternalDirectoryPath,
|
ExternalDirectoryPath: RNFSManager.NSExternalDirectoryPath,
|
||||||
|
TemporaryDirectoryPathIOS: RNFSManager.NSTemporaryDirectoryPath,
|
||||||
LibraryDirectoryPath: RNFSManager.NSLibraryDirectoryPath,
|
LibraryDirectoryPath: RNFSManager.NSLibraryDirectoryPath,
|
||||||
PicturesDirectoryPath: RNFSManager.NSPicturesDirectoryPath
|
PicturesDirectoryPath: RNFSManager.NSPicturesDirectoryPath
|
||||||
};
|
};
|
||||||
|
@ -258,17 +258,17 @@ RCT_EXPORT_METHOD(getFSInfo:(RCTResponseSenderBlock)callback)
|
|||||||
{
|
{
|
||||||
unsigned long long totalSpace = 0;
|
unsigned long long totalSpace = 0;
|
||||||
unsigned long long totalFreeSpace = 0;
|
unsigned long long totalFreeSpace = 0;
|
||||||
|
|
||||||
__autoreleasing NSError *error = nil;
|
__autoreleasing NSError *error = nil;
|
||||||
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
||||||
NSDictionary *dictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths lastObject] error: &error];
|
NSDictionary *dictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths lastObject] error: &error];
|
||||||
|
|
||||||
if (dictionary) {
|
if (dictionary) {
|
||||||
NSNumber *fileSystemSizeInBytes = [dictionary objectForKey: NSFileSystemSize];
|
NSNumber *fileSystemSizeInBytes = [dictionary objectForKey: NSFileSystemSize];
|
||||||
NSNumber *freeFileSystemSizeInBytes = [dictionary objectForKey:NSFileSystemFreeSize];
|
NSNumber *freeFileSystemSizeInBytes = [dictionary objectForKey:NSFileSystemFreeSize];
|
||||||
totalSpace = [fileSystemSizeInBytes unsignedLongLongValue];
|
totalSpace = [fileSystemSizeInBytes unsignedLongLongValue];
|
||||||
totalFreeSpace = [freeFileSystemSizeInBytes unsignedLongLongValue];
|
totalFreeSpace = [freeFileSystemSizeInBytes unsignedLongLongValue];
|
||||||
|
|
||||||
callback(@[[NSNull null],
|
callback(@[[NSNull null],
|
||||||
@{
|
@{
|
||||||
@"totalSpace": [NSNumber numberWithUnsignedLongLong:totalSpace],
|
@"totalSpace": [NSNumber numberWithUnsignedLongLong:totalSpace],
|
||||||
@ -306,6 +306,7 @@ RCT_EXPORT_METHOD(getFSInfo:(RCTResponseSenderBlock)callback)
|
|||||||
@"NSCachesDirectoryPath": [self getPathForDirectory:NSCachesDirectory],
|
@"NSCachesDirectoryPath": [self getPathForDirectory:NSCachesDirectory],
|
||||||
@"NSDocumentDirectoryPath": [self getPathForDirectory:NSDocumentDirectory],
|
@"NSDocumentDirectoryPath": [self getPathForDirectory:NSDocumentDirectory],
|
||||||
@"NSExternalDirectoryPath": [NSNull null],
|
@"NSExternalDirectoryPath": [NSNull null],
|
||||||
|
@"NSTemporaryDirectoryPatg": NSTemporaryDirectory(),
|
||||||
@"NSLibraryDirectoryPath": [self getPathForDirectory:NSLibraryDirectory],
|
@"NSLibraryDirectoryPath": [self getPathForDirectory:NSLibraryDirectory],
|
||||||
@"NSFileTypeRegular": NSFileTypeRegular,
|
@"NSFileTypeRegular": NSFileTypeRegular,
|
||||||
@"NSFileTypeDirectory": NSFileTypeDirectory
|
@"NSFileTypeDirectory": NSFileTypeDirectory
|
||||||
|
Loading…
x
Reference in New Issue
Block a user