Browse Source

Add system dirs to Android native

Ben Hsieh 8 years ago
parent
commit
218c02ce58
1 changed files with 28 additions and 3 deletions
  1. 28
    3
      src/fs.js

+ 28
- 3
src/fs.js View File

35
   return new Promise((resolve, reject) => {
35
   return new Promise((resolve, reject) => {
36
     try {
36
     try {
37
       RNFetchBlob.getEnvironmentDirs((...dirs) => {
37
       RNFetchBlob.getEnvironmentDirs((...dirs) => {
38
-        let [DocumentDir, CacheDir, DCIMDir, DownloadDir] = [...dirs]
39
-        resolve({DocumentDir, CacheDir, DCIMDir, DownloadDir})
38
+        let [
39
+          DocumentDir,
40
+          CacheDir,
41
+          // Android only
42
+          DCIMDir,
43
+          DownloadDir,
44
+          PictureDir,
45
+          MusicDir,
46
+          MovieDir,
47
+          RingToneDir] = [...dirs]
48
+        resolve({
49
+          DocumentDir,
50
+          CacheDir,
51
+          DCIMDir,
52
+          DownloadDir,
53
+          PictureDir,
54
+          MusicDir,
55
+          MovieDir,
56
+          RingToneDir
57
+        })
40
       })
58
       })
41
     } catch(err) {
59
     } catch(err) {
42
       reject(err)
60
       reject(err)
182
   })
200
   })
183
 }
201
 }
184
 
202
 
203
+function lstat(path:string):Promise<Array<RNFetchBlobFile>> {
204
+
205
+}
206
+
185
 function ls(path:string):Promise<Array<String>> {
207
 function ls(path:string):Promise<Array<String>> {
186
   return new Promise((resolve, reject) => {
208
   return new Promise((resolve, reject) => {
187
     RNFetchBlob.ls(path, (err, res) => {
209
     RNFetchBlob.ls(path, (err, res) => {
255
   writeStream,
277
   writeStream,
256
   exists,
278
   exists,
257
   createFile,
279
   createFile,
258
-  isDir
280
+  isDir,
281
+  stat,
282
+  lstat,
283
+  scanFile
259
 }
284
 }