Maj de sheebr + maj mineure des scripts
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
const fs = require('fs');
|
||||
const { resolve } = require('path');
|
||||
|
||||
if(process.argv.length >= 3){
|
||||
// console.log(process.env.path)
|
||||
for(let environmentPath of process.env.path.split(',')){
|
||||
console.log(recursiveSearch(environmentPath, process.argv[3]));
|
||||
}
|
||||
}
|
||||
|
||||
function recursiveSearch(dir, bin){
|
||||
result = []
|
||||
const dirents = fs.readdirSync(dir, {withFileTypes: true});
|
||||
for(const dirent of dirents){
|
||||
const res = resolve(dir, dirent.name);
|
||||
if(dirent.name === bin){
|
||||
result.push(res);
|
||||
}
|
||||
if(dirent.isDirectory())
|
||||
result = result.concat(recursiveSearch(dirent.name, bin))
|
||||
}
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user