-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathpost-script.js
More file actions
23 lines (20 loc) · 778 Bytes
/
post-script.js
File metadata and controls
23 lines (20 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/**
* @file This script is auto-generated by create-nitro-module and should not be edited.
*
* @description This script applies a workaround for Android by modifying the '<ModuleName>OnLoad.cpp' file.
* It reads the file content and removes the 'margelo/nitro/' string from it. This enables support for custom package names.
*
* @module create-nitro-module
*/
const path = require('node:path')
const { writeFile, readFile } = require('node:fs/promises')
const androidWorkaround = async () => {
const androidOnLoadFile = path.join(
process.cwd(),
'nitrogen/generated/android',
'NitroFSOnLoad.cpp'
)
const str = await readFile(androidOnLoadFile, { encoding: 'utf8' })
await writeFile(androidOnLoadFile, str.replace(/margelo\/nitro\//g, ''))
}
androidWorkaround()