- Add automation script for building, packaging, installing, executing and verifying Electron distrubtions across macOS, Ubuntu and Windows. - Add GitHub workflow to run the script to test distributions using the script. - Update README with new workflow status badge. - Add application initialization log to desktop applications to be able to test against crashes before application initialization.
35 lines
831 B
JavaScript
35 lines
831 B
JavaScript
import { access, chmod } from 'fs/promises';
|
|
import { constants } from 'fs';
|
|
import { findSingleFileByExtension } from '../../utils/io.js';
|
|
import { log } from '../../utils/log.js';
|
|
|
|
export async function prepareLinuxApp(desktopDistPath) {
|
|
const { absolutePath: appFile } = await findSingleFileByExtension(
|
|
'AppImage',
|
|
desktopDistPath,
|
|
);
|
|
await makeExecutable(appFile);
|
|
return {
|
|
appExecutablePath: appFile,
|
|
};
|
|
}
|
|
|
|
async function makeExecutable(appFile) {
|
|
if (!appFile) { throw new Error('missing file'); }
|
|
if (await isExecutable(appFile)) {
|
|
log('AppImage is already executable.');
|
|
return;
|
|
}
|
|
log('Making it executable...');
|
|
await chmod(appFile, 0o755);
|
|
}
|
|
|
|
async function isExecutable(file) {
|
|
try {
|
|
await access(file, constants.X_OK);
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|