diff --git a/FS.common.js b/FS.common.js index 62b7ba73..262f8d56 100755 --- a/FS.common.js +++ b/FS.common.js @@ -626,6 +626,7 @@ var RNFS = { TemporaryDirectoryPath: RNFSManager.RNFSTemporaryDirectoryPath, LibraryDirectoryPath: RNFSManager.RNFSLibraryDirectoryPath, PicturesDirectoryPath: RNFSManager.RNFSPicturesDirectoryPath, + MoviesDirectoryPath: RNFSManager.RNFSMoviesDirectoryPath, FileProtectionKeys: RNFSManager.RNFSFileProtectionKeys }; diff --git a/android/src/main/java/com/rnfs/RNFSManager.java b/android/src/main/java/com/rnfs/RNFSManager.java index 351ac066..9587bdc9 100755 --- a/android/src/main/java/com/rnfs/RNFSManager.java +++ b/android/src/main/java/com/rnfs/RNFSManager.java @@ -48,6 +48,7 @@ public class RNFSManager extends ReactContextBaseJavaModule { private static final String RNFSExternalDirectoryPath = "RNFSExternalDirectoryPath"; private static final String RNFSExternalStorageDirectoryPath = "RNFSExternalStorageDirectoryPath"; private static final String RNFSPicturesDirectoryPath = "RNFSPicturesDirectoryPath"; + private static final String RNFSMoviesDirectoryPath = "RNFSMoviesDirectoryPath"; private static final String RNFSDownloadDirectoryPath = "RNFSDownloadDirectoryPath"; private static final String RNFSTemporaryDirectoryPath = "RNFSTemporaryDirectoryPath"; private static final String RNFSCachesDirectoryPath = "RNFSCachesDirectoryPath"; @@ -994,6 +995,7 @@ public Map getConstants() { constants.put(RNFSDocumentDirectoryPath, this.getReactApplicationContext().getFilesDir().getAbsolutePath()); constants.put(RNFSTemporaryDirectoryPath, this.getReactApplicationContext().getCacheDir().getAbsolutePath()); constants.put(RNFSPicturesDirectoryPath, Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath()); + constants.put(RNFSMoviesDirectoryPath, Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES).getAbsolutePath()); constants.put(RNFSCachesDirectoryPath, this.getReactApplicationContext().getCacheDir().getAbsolutePath()); constants.put(RNFSDownloadDirectoryPath, Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath()); constants.put(RNFSFileTypeRegular, 0); diff --git a/index.d.ts b/index.d.ts index da3fa7de..07c7dab9 100644 --- a/index.d.ts +++ b/index.d.ts @@ -291,4 +291,5 @@ export const ExternalStorageDirectoryPath: string export const TemporaryDirectoryPath: string export const LibraryDirectoryPath: string export const PicturesDirectoryPath: string +export const MoviesDirectoryPath: string export const FileProtectionKeys: string diff --git a/windows/RNFS.Net46/RNFSManager.cs b/windows/RNFS.Net46/RNFSManager.cs index 3fbb078e..2b9d85f3 100644 --- a/windows/RNFS.Net46/RNFSManager.cs +++ b/windows/RNFS.Net46/RNFSManager.cs @@ -80,6 +80,7 @@ public override IReadOnlyDictionary Constants { "RNFSDocumentDirectoryPath", KnownFolders.Documents.Path }, { "RNFSTemporaryDirectoryPath", KnownFolders.InternetCache.Path }, { "RNFSPicturesDirectoryPath", KnownFolders.CameraRoll.Path }, + { "RNFSMoviesDirectoryPath", KnownFolders.VideosLibrary.Path }, { "RNFSFileTypeRegular", 0 }, { "RNFSFileTypeDirectory", 1 }, }; diff --git a/windows/RNFS/RNFSManager.cs b/windows/RNFS/RNFSManager.cs index cf433bd0..a1f83043 100644 --- a/windows/RNFS/RNFSManager.cs +++ b/windows/RNFS/RNFSManager.cs @@ -99,6 +99,12 @@ public override IReadOnlyDictionary Constants constants.Add("RNFSPicturesDirectoryPath", pictures); } + var movies = GetFolderPathSafe(() => KnownFolders.VideosLibrary); + if (movies != null) + { + constants.Add("RNFSMoviesDirectoryPath", movies); + } + return constants; } }