mirror of
https://github.com/status-im/react-native-fs.git
synced 2025-03-01 07:20:33 +00:00
Removed NS prefixes to avoid confusion
This commit is contained in:
parent
333de79eae
commit
29f58f1560
@ -1,4 +1,5 @@
|
||||
[ignore]
|
||||
.*/node_modules/.*
|
||||
|
||||
[include]
|
||||
|
||||
|
28
FS.common.js
28
FS.common.js
@ -14,8 +14,8 @@ var DeviceEventEmitter = require('react-native').DeviceEventEmitter; // A
|
||||
var base64 = require('base-64');
|
||||
var utf8 = require('utf8');
|
||||
|
||||
var NSFileTypeRegular = RNFSManager.NSFileTypeRegular;
|
||||
var NSFileTypeDirectory = RNFSManager.NSFileTypeDirectory;
|
||||
var RNFSFileTypeRegular = RNFSManager.RNFSFileTypeRegular;
|
||||
var RNFSFileTypeDirectory = RNFSManager.RNFSFileTypeDirectory;
|
||||
|
||||
var jobId = 0;
|
||||
|
||||
@ -25,7 +25,7 @@ var getJobId = () => {
|
||||
};
|
||||
|
||||
type MkdirOptions = {
|
||||
NSURLIsExcludedFromBackupKey?: boolean;
|
||||
RNFSURLIsExcludedFromBackupKey?: boolean;
|
||||
};
|
||||
|
||||
type ReadDirItem = {
|
||||
@ -160,8 +160,8 @@ var RNFS = {
|
||||
name: file.name,
|
||||
path: file.path,
|
||||
size: file.size,
|
||||
isFile: () => file.type === NSFileTypeRegular,
|
||||
isDirectory: () => file.type === NSFileTypeDirectory,
|
||||
isFile: () => file.type === RNFSFileTypeRegular,
|
||||
isDirectory: () => file.type === RNFSFileTypeDirectory,
|
||||
}));
|
||||
});
|
||||
},
|
||||
@ -180,8 +180,8 @@ var RNFS = {
|
||||
'mtime': new Date(result.mtime * 1000),
|
||||
'size': result.size,
|
||||
'mode': result.mode,
|
||||
isFile: () => result.type === NSFileTypeRegular,
|
||||
isDirectory: () => result.type === NSFileTypeDirectory,
|
||||
isFile: () => result.type === RNFSFileTypeRegular,
|
||||
isDirectory: () => result.type === RNFSFileTypeDirectory,
|
||||
};
|
||||
});
|
||||
},
|
||||
@ -360,13 +360,13 @@ var RNFS = {
|
||||
});
|
||||
},
|
||||
|
||||
MainBundlePath: RNFSManager.MainBundlePath,
|
||||
CachesDirectoryPath: RNFSManager.NSCachesDirectoryPath,
|
||||
DocumentDirectoryPath: RNFSManager.NSDocumentDirectoryPath,
|
||||
ExternalDirectoryPath: RNFSManager.NSExternalDirectoryPath,
|
||||
TemporaryDirectoryPath: RNFSManager.NSTemporaryDirectoryPath,
|
||||
LibraryDirectoryPath: RNFSManager.NSLibraryDirectoryPath,
|
||||
PicturesDirectoryPath: RNFSManager.NSPicturesDirectoryPath
|
||||
MainBundlePath: RNFSManager.RNFSMainBundlePath,
|
||||
CachesDirectoryPath: RNFSManager.RNFSCachesDirectoryPath,
|
||||
DocumentDirectoryPath: RNFSManager.RNFSDocumentDirectoryPath,
|
||||
ExternalDirectoryPath: RNFSManager.RNFSExternalDirectoryPath,
|
||||
TemporaryDirectoryPath: RNFSManager.RNFSTemporaryDirectoryPath,
|
||||
LibraryDirectoryPath: RNFSManager.RNFSLibraryDirectoryPath,
|
||||
PicturesDirectoryPath: RNFSManager.RNFSPicturesDirectoryPath
|
||||
|
||||
};
|
||||
|
||||
|
@ -443,14 +443,14 @@ RCT_EXPORT_METHOD(getFSInfo:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromise
|
||||
- (NSDictionary *)constantsToExport
|
||||
{
|
||||
return @{
|
||||
@"MainBundlePath": [[NSBundle mainBundle] bundlePath],
|
||||
@"NSCachesDirectoryPath": [self getPathForDirectory:NSCachesDirectory],
|
||||
@"NSDocumentDirectoryPath": [self getPathForDirectory:NSDocumentDirectory],
|
||||
@"NSExternalDirectoryPath": [NSNull null],
|
||||
@"NSTemporaryDirectoryPath": NSTemporaryDirectory(),
|
||||
@"NSLibraryDirectoryPath": [self getPathForDirectory:NSLibraryDirectory],
|
||||
@"NSFileTypeRegular": NSFileTypeRegular,
|
||||
@"NSFileTypeDirectory": NSFileTypeDirectory
|
||||
@"RNFSMainBundlePath": [[NSBundle mainBundle] bundlePath],
|
||||
@"RNFSCachesDirectoryPath": [self getPathForDirectory:NSCachesDirectory],
|
||||
@"RNFSDocumentDirectoryPath": [self getPathForDirectory:NSDocumentDirectory],
|
||||
@"RNFSExternalDirectoryPath": [NSNull null],
|
||||
@"RNFSTemporaryDirectoryPath": NSTemporaryDirectory(),
|
||||
@"RNFSLibraryDirectoryPath": [self getPathForDirectory:NSLibraryDirectory],
|
||||
@"RNFSFileTypeRegular": NSFileTypeRegular,
|
||||
@"RNFSFileTypeDirectory": NSFileTypeDirectory
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -31,15 +31,15 @@ import com.facebook.react.modules.core.RCTNativeAppEventEmitter;
|
||||
|
||||
public class RNFSManager extends ReactContextBaseJavaModule {
|
||||
|
||||
private static final String NSDocumentDirectoryPath = "NSDocumentDirectoryPath";
|
||||
private static final String NSExternalDirectoryPath = "NSExternalDirectoryPath";
|
||||
private static final String NSPicturesDirectoryPath = "NSPicturesDirectoryPath";
|
||||
private static final String NSTemporaryDirectoryPath = "NSTemporaryDirectoryPath";
|
||||
private static final String NSCachesDirectoryPath = "NSCachesDirectoryPath";
|
||||
private static final String NSDocumentDirectory = "NSDocumentDirectory";
|
||||
private static final String RNFSDocumentDirectoryPath = "RNFSDocumentDirectoryPath";
|
||||
private static final String RNFSExternalDirectoryPath = "RNFSExternalDirectoryPath";
|
||||
private static final String RNFSPicturesDirectoryPath = "RNFSPicturesDirectoryPath";
|
||||
private static final String RNFSTemporaryDirectoryPath = "RNFSTemporaryDirectoryPath";
|
||||
private static final String RNFSCachesDirectoryPath = "RNFSCachesDirectoryPath";
|
||||
private static final String RNFSDocumentDirectory = "RNFSDocumentDirectory";
|
||||
|
||||
private static final String NSFileTypeRegular = "NSFileTypeRegular";
|
||||
private static final String NSFileTypeDirectory = "NSFileTypeDirectory";
|
||||
private static final String RNFSFileTypeRegular = "RNFSFileTypeRegular";
|
||||
private static final String RNFSFileTypeDirectory = "RNFSFileTypeDirectory";
|
||||
|
||||
private SparseArray<Downloader> downloaders = new SparseArray<Downloader>();
|
||||
|
||||
@ -394,19 +394,19 @@ public class RNFSManager extends ReactContextBaseJavaModule {
|
||||
@Override
|
||||
public Map<String, Object> getConstants() {
|
||||
final Map<String, Object> constants = new HashMap<>();
|
||||
constants.put(NSDocumentDirectory, 0);
|
||||
constants.put(NSDocumentDirectoryPath, this.getReactApplicationContext().getFilesDir().getAbsolutePath());
|
||||
constants.put(NSTemporaryDirectoryPath, null);
|
||||
constants.put(RNFSDocumentDirectory, 0);
|
||||
constants.put(RNFSDocumentDirectoryPath, this.getReactApplicationContext().getFilesDir().getAbsolutePath());
|
||||
constants.put(RNFSTemporaryDirectoryPath, null);
|
||||
File externalDirectory = this.getReactApplicationContext().getExternalFilesDir(null);
|
||||
if (externalDirectory != null) {
|
||||
constants.put(NSExternalDirectoryPath, externalDirectory.getAbsolutePath());
|
||||
constants.put(RNFSExternalDirectoryPath, externalDirectory.getAbsolutePath());
|
||||
} else {
|
||||
constants.put(NSExternalDirectoryPath, null);
|
||||
constants.put(RNFSExternalDirectoryPath, null);
|
||||
}
|
||||
constants.put(NSPicturesDirectoryPath, Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath());
|
||||
constants.put(NSCachesDirectoryPath, this.getReactApplicationContext().getCacheDir().getAbsolutePath());
|
||||
constants.put(NSFileTypeRegular, 0);
|
||||
constants.put(NSFileTypeDirectory, 1);
|
||||
constants.put(RNFSPicturesDirectoryPath, Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath());
|
||||
constants.put(RNFSCachesDirectoryPath, this.getReactApplicationContext().getCacheDir().getAbsolutePath());
|
||||
constants.put(RNFSFileTypeRegular, 0);
|
||||
constants.put(RNFSFileTypeDirectory, 1);
|
||||
return constants;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user