line endings will be the death of me

This commit is contained in:
Samuel Attard
2024-10-05 21:40:14 -07:00
parent fc79921163
commit 4c4d213c79
2 changed files with 7 additions and 22 deletions

1
.gitattributes vendored
View File

@@ -3,6 +3,7 @@
*.patch text eol=lf
DEPS text eol=lf
yarn.lock text eol=lf
script/zip_manifests/*.manifest text eol=lf
patches/**/.patches merge=union
# Source code and markdown files should always use LF as line ending.

View File

@@ -18,28 +18,12 @@ export async function copyApp (targetDir: string): Promise<string> {
const baseDir = path.dirname(process.execPath);
const zipManifestPath = path.resolve(__dirname, '..', '..', 'script', 'zip_manifests', `dist_zip.${process.platform === 'win32' ? 'win' : 'linux'}.${process.arch}.manifest`);
const filesToCopy = (fs.readFileSync(zipManifestPath, 'utf-8')).split('\n').filter(f => f !== 'LICENSE' && f !== 'LICENSES.chromium.html' && f !== 'version' && f.trim());
const dirsToMake: string[] = [];
for (const rel of filesToCopy) {
const dir = path.dirname(path.resolve(targetDir, rel));
if (!dirsToMake.includes(dir)) {
dirsToMake.push(dir);
}
}
for (const dir of dirsToMake) {
await fs.promises.mkdir(dir, { recursive: true });
}
console.log('copying to:', targetDir);
for (const rel of filesToCopy) {
console.log('base:', baseDir);
console.log('rel:', rel);
console.log('dir:', path.dirname(path.resolve(baseDir, rel)));
console.log('exists p:', path.resolve(baseDir, rel));
console.log('ls base:', fs.readdirSync(baseDir));
console.log('ls dir:', fs.readdirSync(path.dirname(path.resolve(baseDir, rel))));
console.log('exists rel:', fs.existsSync(path.resolve(baseDir, rel)));
fs.copyFileSync(path.resolve(baseDir, rel), path.resolve(targetDir, rel));
}
await Promise.all(
filesToCopy.map(async rel => {
await fs.promises.mkdir(path.dirname(path.resolve(targetDir, rel)), { recursive: true });
fs.copyFileSync(path.resolve(baseDir, rel), path.resolve(targetDir, rel));
})
);
return path.resolve(targetDir, path.basename(process.execPath));
}