Revert "build: remove dead symlink from MAS build (#23831)" (#24146)

This reverts commit 7a216a8fab.
This commit is contained in:
Samuel Attard 2020-06-15 23:42:18 -07:00 committed by GitHub
parent 7a216a8fab
commit 7bf0af7d96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 19 additions and 93 deletions

View file

@ -1,42 +0,0 @@
const fs = require('fs');
const path = require('path');
const utils = require('./lib/utils');
if (process.platform !== 'darwin') {
console.log('Not checking symlinks on non-darwin platform');
process.exit(0);
}
const appPath = path.resolve(__dirname, '..', '..', 'out', utils.getOutDir(), 'Electron.app');
const visited = new Set();
const traverse = (p) => {
if (visited.has(p)) return;
visited.add(p);
if (!fs.statSync(p).isDirectory()) return;
for (const child of fs.readdirSync(p)) {
const childPath = path.resolve(p, child);
let realPath;
try {
realPath = fs.realpathSync(childPath);
} catch (err) {
if (err.path) {
console.error('Detected an invalid symlink');
console.error('Source:', childPath);
let link = fs.readlinkSync(childPath);
if (!link.startsWith('.')) {
link = `../${link}`;
}
console.error('Target:', path.resolve(childPath, link));
process.exit(1);
} else {
throw err;
}
}
traverse(realPath);
}
};
traverse(appPath);