mirror of
https://github.com/xodio/xod.git
synced 2026-03-24 17:46:56 +01:00
fix(xod-fs): add file/dir names to ignore while reading directories
This commit is contained in:
@@ -22,3 +22,10 @@ export const CHANGE_TYPES = {
|
||||
ADDED: 'ADDED',
|
||||
DELETED: 'DELETED',
|
||||
};
|
||||
|
||||
export const IGNORE_FILENAMES = [
|
||||
'.*', // hidden files on Posix
|
||||
'*~', // backups
|
||||
'Thumbs.db', // Windows image file
|
||||
'desktop.ini', // Windows folder meta information
|
||||
];
|
||||
|
||||
@@ -3,12 +3,13 @@ import path from 'path';
|
||||
import recReadDir from 'recursive-readdir';
|
||||
|
||||
import { expandHomeDir } from './utils';
|
||||
import { IGNORE_FILENAMES } from './constants';
|
||||
|
||||
// :: rootPath -> Promise
|
||||
export const readDir = rootPath =>
|
||||
new Promise((resolve, reject) => {
|
||||
const resolvedPath = path.resolve(expandHomeDir(rootPath));
|
||||
recReadDir(resolvedPath, (err, files) => {
|
||||
recReadDir(resolvedPath, IGNORE_FILENAMES, (err, files) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user