Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose movies directory #1097

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions FS.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,7 @@ var RNFS = {
TemporaryDirectoryPath: RNFSManager.RNFSTemporaryDirectoryPath,
LibraryDirectoryPath: RNFSManager.RNFSLibraryDirectoryPath,
PicturesDirectoryPath: RNFSManager.RNFSPicturesDirectoryPath,
MoviesDirectoryPath: RNFSManager.RNFSMoviesDirectoryPath,
FileProtectionKeys: RNFSManager.RNFSFileProtectionKeys
};

Expand Down
2 changes: 2 additions & 0 deletions android/src/main/java/com/rnfs/RNFSManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -994,6 +995,7 @@ public Map<String, Object> 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);
Expand Down
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions windows/RNFS.Net46/RNFSManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public override IReadOnlyDictionary<string, object> Constants
{ "RNFSDocumentDirectoryPath", KnownFolders.Documents.Path },
{ "RNFSTemporaryDirectoryPath", KnownFolders.InternetCache.Path },
{ "RNFSPicturesDirectoryPath", KnownFolders.CameraRoll.Path },
{ "RNFSMoviesDirectoryPath", KnownFolders.VideosLibrary.Path },
{ "RNFSFileTypeRegular", 0 },
{ "RNFSFileTypeDirectory", 1 },
};
Expand Down
6 changes: 6 additions & 0 deletions windows/RNFS/RNFSManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ public override IReadOnlyDictionary<string, object> Constants
constants.Add("RNFSPicturesDirectoryPath", pictures);
}

var movies = GetFolderPathSafe(() => KnownFolders.VideosLibrary);
if (movies != null)
{
constants.Add("RNFSMoviesDirectoryPath", movies);
}

return constants;
}
}
Expand Down