Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 24 additions & 25 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,33 +136,32 @@ export async function walkAsync (dirPath: string): Promise<string[]> {
debugLog('Walking... ' + dirPath);

async function _walkAsync (dirPath: string): Promise<DeepList<string>> {
const res: DeepList<string> = [];
const children = await fs.readdir(dirPath);
return await Promise.all(
children.map(async (child) => {
const filePath = path.resolve(dirPath, child);

const stat = await fs.stat(filePath);
if (stat.isFile()) {
switch (path.extname(filePath)) {
case '.cstemp': // Temporary file generated from past codesign
debugLog('Removing... ' + filePath);
await fs.remove(filePath);
return null;
default:
return await getFilePathIfBinary(filePath);
}
} else if (stat.isDirectory() && !stat.isSymbolicLink()) {
const walkResult = await _walkAsync(filePath);
switch (path.extname(filePath)) {
case '.app': // Application
case '.framework': // Framework
walkResult.push(filePath);
}
return walkResult;
for (const child of children) {
const filePath = path.resolve(dirPath, child);
const stat = await fs.stat(filePath);
if (stat.isFile()) {
switch (path.extname(filePath)) {
case '.cstemp': // Temporary file generated from past codesign
debugLog('Removing... ' + filePath);
await fs.remove(filePath);
break;
default:
await getFilePathIfBinary(filePath) && res.push(filePath);
break;
}
return null;
})
);
} else if (stat.isDirectory() && !stat.isSymbolicLink()) {
const walkResult = await _walkAsync(filePath);
switch (path.extname(filePath)) {
case '.app': // Application
case '.framework': // Framework
walkResult.push(filePath);
}
res.push(walkResult);
}
}
return res;
}

const allPaths = await _walkAsync(dirPath);
Expand Down