(filepath:string, parent:number)
| 2020 | } |
| 2021 | }, |
| 2022 | statWrapper = function node_apps_directory_wrapper(filepath:string, parent:number):void { |
| 2023 | node.fs[method](filepath, function node_apps_directory_wrapper_stat(er:Error, stat:Stats):void { |
| 2024 | const angrypath:string = `Filepath ${text.angry + filepath + text.none} is not a file or directory.`, |
| 2025 | dir = function node_apps_directory_wrapper_stat_dir(item:string):void { |
| 2026 | node.fs.readdir(item, {encoding: "utf8"}, function node_apps_directory_wrapper_stat_dir_readdirs(erd:Error, files:string[]):void { |
| 2027 | if (erd !== null) { |
| 2028 | apps.errout([erd.toString()]); |
| 2029 | return; |
| 2030 | } |
| 2031 | const index:number = list.length; |
| 2032 | if (listonly === true) { |
| 2033 | filelist.push(item); |
| 2034 | } else { |
| 2035 | list.push([item, "directory", parent, files.length, stat]); |
| 2036 | } |
| 2037 | if (files.length < 1) { |
| 2038 | dirCounter(item); |
| 2039 | } else { |
| 2040 | // dircount and dirnames are parallel arrays |
| 2041 | dircount.push(files.length); |
| 2042 | dirnames.push(item); |
| 2043 | dirs = dirs + 1; |
| 2044 | } |
| 2045 | files.forEach(function node_apps_directory_wrapper_stat_dir_readdirs_each(value:string):void { |
| 2046 | node_apps_directory_wrapper(item + sep + value, index); |
| 2047 | }); |
| 2048 | }); |
| 2049 | }, |
| 2050 | populate = function node_apps_directory_wrapper_stat_populate(type:"link"|"file"|"directory"):void { |
| 2051 | if (exclusions.indexOf(filepath.replace(startPath + sep, "")) < 0) { |
| 2052 | if (listonly === true) { |
| 2053 | filelist.push(filepath); |
| 2054 | } else { |
| 2055 | list.push([filepath, type, parent, 0, stat]); |
| 2056 | } |
| 2057 | } |
| 2058 | if (dirs > 0) { |
| 2059 | dirCounter(filepath); |
| 2060 | } else { |
| 2061 | if (listonly === true) { |
| 2062 | args.callback(filelist.sort()); |
| 2063 | } else { |
| 2064 | args.callback(list); |
| 2065 | } |
| 2066 | } |
| 2067 | }; |
| 2068 | if (er !== null) { |
| 2069 | if (er.toString().indexOf("no such file or directory") > 0) { |
| 2070 | if (errorflag === true) { |
| 2071 | args.callback([]); |
| 2072 | return; |
| 2073 | } |
| 2074 | if (type === true) { |
| 2075 | apps.log([`Requested artifact, ${text.cyan + startPath + text.none}, ${text.angry}is missing${text.none}.`], "", ""); |
| 2076 | return; |
| 2077 | } |
| 2078 | apps.errout([angrypath]); |
| 2079 | return; |
no test coverage detected