* Identifies if the path is directory * * @param {String} abspath Absolute path, should be already have replaced '\' with '/' to support Windows * @param {Object} found Object: {dirs: [], files: [] }, contains information about directory's files and subdirectories * @return {Object}
(abspath, found)
| 39 | * @return {Object} Updated 'found' object |
| 40 | */ |
| 41 | function isDir(abspath, found) { |
| 42 | var stat = fs.statSync(abspath), |
| 43 | abspathAry = abspath.split('/'), |
| 44 | data, |
| 45 | file_name; |
| 46 | |
| 47 | if (!found) { |
| 48 | found = {dirs: [], files: [] } |
| 49 | } |
| 50 | |
| 51 | if (stat.isDirectory() && !isHidden(abspathAry[abspathAry.length - 1])) { |
| 52 | found.dirs.push(abspath); |
| 53 | |
| 54 | /* If we found a directory, recurse! */ |
| 55 | data = exports.readDirSync(abspath); |
| 56 | found.dirs = found.dirs.concat(data.dirs); |
| 57 | found.files = found.files.concat(data.files); |
| 58 | |
| 59 | } else { |
| 60 | |
| 61 | abspathAry = abspath.split('/'); |
| 62 | file_name = abspathAry[abspathAry.length - 1]; |
| 63 | |
| 64 | if (!isHidden(file_name)) { |
| 65 | found.files.push(abspath); |
| 66 | } |
| 67 | } |
| 68 | return found; |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * @ngdoc service |