Skip to content

Commit 810157f

Browse files
authored
Expose movies directory (#1)
* Expose MoviesDirectoryPath for Android * Add VideosLibrary Path * Fix bad copy-paste job Authored-by: Nathan Nahi <[email protected]>
1 parent 370315e commit 810157f

File tree

5 files changed

+11
-0
lines changed

5 files changed

+11
-0
lines changed

FS.common.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,7 @@ var RNFS = {
626626
TemporaryDirectoryPath: RNFSManager.RNFSTemporaryDirectoryPath,
627627
LibraryDirectoryPath: RNFSManager.RNFSLibraryDirectoryPath,
628628
PicturesDirectoryPath: RNFSManager.RNFSPicturesDirectoryPath,
629+
MoviesDirectoryPath: RNFSManager.RNFSMoviesDirectoryPath,
629630
FileProtectionKeys: RNFSManager.RNFSFileProtectionKeys
630631
};
631632

android/src/main/java/com/rnfs/RNFSManager.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public class RNFSManager extends ReactContextBaseJavaModule {
4848
private static final String RNFSExternalDirectoryPath = "RNFSExternalDirectoryPath";
4949
private static final String RNFSExternalStorageDirectoryPath = "RNFSExternalStorageDirectoryPath";
5050
private static final String RNFSPicturesDirectoryPath = "RNFSPicturesDirectoryPath";
51+
private static final String RNFSMoviesDirectoryPath = "RNFSMoviesDirectoryPath";
5152
private static final String RNFSDownloadDirectoryPath = "RNFSDownloadDirectoryPath";
5253
private static final String RNFSTemporaryDirectoryPath = "RNFSTemporaryDirectoryPath";
5354
private static final String RNFSCachesDirectoryPath = "RNFSCachesDirectoryPath";
@@ -994,6 +995,7 @@ public Map<String, Object> getConstants() {
994995
constants.put(RNFSDocumentDirectoryPath, this.getReactApplicationContext().getFilesDir().getAbsolutePath());
995996
constants.put(RNFSTemporaryDirectoryPath, this.getReactApplicationContext().getCacheDir().getAbsolutePath());
996997
constants.put(RNFSPicturesDirectoryPath, Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath());
998+
constants.put(RNFSMoviesDirectoryPath, Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES).getAbsolutePath());
997999
constants.put(RNFSCachesDirectoryPath, this.getReactApplicationContext().getCacheDir().getAbsolutePath());
9981000
constants.put(RNFSDownloadDirectoryPath, Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath());
9991001
constants.put(RNFSFileTypeRegular, 0);

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,4 +291,5 @@ export const ExternalStorageDirectoryPath: string
291291
export const TemporaryDirectoryPath: string
292292
export const LibraryDirectoryPath: string
293293
export const PicturesDirectoryPath: string
294+
export const MoviesDirectoryPath: string
294295
export const FileProtectionKeys: string

windows/RNFS.Net46/RNFSManager.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public override IReadOnlyDictionary<string, object> Constants
8080
{ "RNFSDocumentDirectoryPath", KnownFolders.Documents.Path },
8181
{ "RNFSTemporaryDirectoryPath", KnownFolders.InternetCache.Path },
8282
{ "RNFSPicturesDirectoryPath", KnownFolders.CameraRoll.Path },
83+
{ "RNFSMoviesDirectoryPath", KnownFolders.VideosLibrary.Path },
8384
{ "RNFSFileTypeRegular", 0 },
8485
{ "RNFSFileTypeDirectory", 1 },
8586
};

windows/RNFS/RNFSManager.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ public override IReadOnlyDictionary<string, object> Constants
9999
constants.Add("RNFSPicturesDirectoryPath", pictures);
100100
}
101101

102+
var movies = GetFolderPathSafe(() => KnownFolders.VideosLibrary);
103+
if (movies != null)
104+
{
105+
constants.Add("RNFSMoviesDirectoryPath", movies);
106+
}
107+
102108
return constants;
103109
}
104110
}

0 commit comments

Comments
 (0)