mirror of
https://github.com/koodo-reader/koodo-reader.git
synced 2026-04-29 11:24:43 -04:00
- Implemented a script to list locale folders and identify missing translation terms in English. - Added functionality to copy missing terms from Chinese translations to English. - Enhanced the script to fill in missing terms for other languages based on the updated English file. - Created a patch script for nan.h to comment out the inclusion of nan_scriptorigin.h for cross-platform compatibility.
27 lines
752 B
JavaScript
27 lines
752 B
JavaScript
/**
|
|
* Cross-platform replacement for the sed command in postinstall.
|
|
* Patches nan.h to comment out the #include nan_scriptorigin.h line.
|
|
*/
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const nanHPath = path.join(__dirname, '..', 'node_modules', 'nan', 'nan.h');
|
|
|
|
if (!fs.existsSync(nanHPath)) {
|
|
console.log('nan.h not found, skipping patch.');
|
|
process.exit(0);
|
|
}
|
|
|
|
let content = fs.readFileSync(nanHPath, 'utf8');
|
|
const patched = content.replace(
|
|
/^#include [<"]nan_scriptorigin\.h[>"]/m,
|
|
'// #include nan_scriptorigin.h'
|
|
);
|
|
|
|
if (content === patched) {
|
|
console.log('nan.h already patched or pattern not found, skipping.');
|
|
} else {
|
|
fs.writeFileSync(nanHPath, patched, 'utf8');
|
|
console.log('nan.h patched successfully.');
|
|
}
|