bare-fs 2.1.1 → 2.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CMakeLists.txt CHANGED
@@ -7,7 +7,7 @@ include(bare)
7
7
  add_bare_module(bare_fs)
8
8
 
9
9
  target_sources(
10
- bare_fs
10
+ ${bare_fs}
11
11
  PRIVATE
12
12
  binding.c
13
13
  )
package/index.js CHANGED
@@ -605,7 +605,16 @@ function mkdirRecursive (filepath, mode, cb) {
605
605
 
606
606
  mkdirRecursive(filepath.slice(0, i), mode, function (err) {
607
607
  if (err) return cb(err, err.errno, null)
608
- mkdir(filepath, { mode }, cb)
608
+
609
+ mkdir(filepath, { mode }, function (err) {
610
+ if (err === null) return cb(null, 0, null)
611
+
612
+ stat(filepath, function (e, st) {
613
+ if (e) return cb(e, e.errno, null)
614
+ if (st.isDirectory()) return cb(null, 0, null)
615
+ cb(err, err.errno, null)
616
+ })
617
+ })
609
618
  })
610
619
  })
611
620
  }
@@ -647,7 +656,16 @@ function mkdirResursiveSync (filepath, mode) {
647
656
  if (i <= 0) throw err
648
657
 
649
658
  mkdirResursiveSync(filepath.slice(0, i), { mode })
650
- mkdirSync(filepath, { mode })
659
+
660
+ try {
661
+ mkdirSync(filepath, { mode })
662
+ } catch (err) {
663
+ if (statSync(filepath).isDirectory()) {
664
+ return
665
+ }
666
+
667
+ throw err
668
+ }
651
669
  }
652
670
  }
653
671
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-fs",
3
- "version": "2.1.1",
3
+ "version": "2.1.3",
4
4
  "description": "Native file system for Javascript",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -11,9 +11,7 @@
11
11
  "CMakeLists.txt",
12
12
  "prebuilds"
13
13
  ],
14
- "addon": {
15
- "target": "bare_fs"
16
- },
14
+ "addon": true,
17
15
  "scripts": {
18
16
  "test": "standard && bare test.js"
19
17
  },