@jdeighan/coffee-utils 7.0.5 → 7.0.8
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/fs_utils.coffee +7 -1
- package/src/fs_utils.js +8 -1
package/package.json
CHANGED
package/src/fs_utils.coffee
CHANGED
@@ -186,13 +186,19 @@ export withUnderScore = (path) ->
|
|
186
186
|
{dir, base} = pathlib.parse(path)
|
187
187
|
return mkpath(dir, "_#{base}")
|
188
188
|
|
189
|
+
# ---------------------------------------------------------------------------
|
190
|
+
|
191
|
+
isSystemDir = (dir) ->
|
192
|
+
|
193
|
+
return dir in ['$Recycle.Bin', '$WinREAgent']
|
194
|
+
|
189
195
|
# ---------------------------------------------------------------------------
|
190
196
|
# Get all subdirectories of a directory
|
191
197
|
|
192
198
|
export getSubDirs = (dir) ->
|
193
199
|
|
194
200
|
return fs.readdirSync(dir, {withFileTypes: true}) \
|
195
|
-
.filter((d) -> d.isDirectory()) \
|
201
|
+
.filter((d) -> d.isDirectory() && !isSystemDir(d.name)) \
|
196
202
|
.map((d) -> mkpath(d.name)) \
|
197
203
|
.sort()
|
198
204
|
|
package/src/fs_utils.js
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
// Generated by CoffeeScript 2.6.1
|
2
2
|
// fs_utils.coffee
|
3
|
+
var isSystemDir;
|
4
|
+
|
3
5
|
import pathlib from 'path';
|
4
6
|
|
5
7
|
import urllib from 'url';
|
@@ -217,13 +219,18 @@ export var withUnderScore = function(path) {
|
|
217
219
|
return mkpath(dir, `_${base}`);
|
218
220
|
};
|
219
221
|
|
222
|
+
// ---------------------------------------------------------------------------
|
223
|
+
isSystemDir = function(dir) {
|
224
|
+
return dir === '$Recycle.Bin' || dir === '$WinREAgent';
|
225
|
+
};
|
226
|
+
|
220
227
|
// ---------------------------------------------------------------------------
|
221
228
|
// Get all subdirectories of a directory
|
222
229
|
export var getSubDirs = function(dir) {
|
223
230
|
return fs.readdirSync(dir, {
|
224
231
|
withFileTypes: true
|
225
232
|
}).filter(function(d) {
|
226
|
-
return d.isDirectory();
|
233
|
+
return d.isDirectory() && !isSystemDir(d.name);
|
227
234
|
}).map(function(d) {
|
228
235
|
return mkpath(d.name);
|
229
236
|
}).sort();
|