Merge branch 'master' of https://github.com/ngrj/react-native-fs into ngrj-master
* 'master' of https://github.com/ngrj/react-native-fs: added a function called getAllExternalFilesDirs to get application-specific directories on all shared/external storage devices
This commit is contained in:
commit
fd39484c75
|
@ -201,6 +201,10 @@ var RNFS = {
|
|||
return RNFSManager.getFSInfo();
|
||||
},
|
||||
|
||||
getAllExternalFilesDirs(): Promise<FSInfoResult> {
|
||||
return RNFSManager.getAllExternalFilesDirs();
|
||||
},
|
||||
|
||||
unlink(filepath: string): Promise<void> {
|
||||
return RNFSManager.unlink(normalizeFilePath(filepath)).then(() => void 0);
|
||||
},
|
||||
|
|
|
@ -654,6 +654,10 @@ type FSInfoResult = {
|
|||
};
|
||||
```
|
||||
|
||||
### `getAllExternalFilesDirs(): Promise<ExternalFilesDirs>`
|
||||
|
||||
Returns an array with the absolute paths to application-specific directories on all shared/external storage devices where the application can place persistent files it owns.
|
||||
|
||||
### (iOS only) `pathForGroup(groupIdentifier: string): Promise<string>`
|
||||
|
||||
`groupIdentifier` (`string`) Any value from the *com.apple.security.application-groups* entitlements list.
|
||||
|
|
|
@ -706,6 +706,16 @@ public class RNFSManager extends ReactContextBaseJavaModule {
|
|||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void getAllExternalFilesDirs(Promise promise){
|
||||
File[] allExternalFilesDirs = this.getReactApplicationContext().getExternalFilesDirs(null);
|
||||
WritableArray fs = Arguments.createArray();
|
||||
for (File f : allExternalFilesDirs) {
|
||||
fs.pushString(f.getAbsolutePath());
|
||||
}
|
||||
promise.resolve(fs);
|
||||
}
|
||||
|
||||
private void reject(Promise promise, String filepath, Exception ex) {
|
||||
if (ex instanceof FileNotFoundException) {
|
||||
rejectFileNotFound(promise, filepath);
|
||||
|
|
Loading…
Reference in New Issue