Skip to content

Commit e563eb9

Browse files
authored
Merge pull request #40 from NikitaDudin/handle-symlink-errors
Handle symlink error when copying files from cpp to android/cpp
2 parents 55dfb2a + 4e722e8 commit e563eb9

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

package/scripts/install-npm.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ console.log("Updating symlinks for Android build...");
55

66
const createSymlink = (p) => {
77
console.log(`Creating symlink to ${p}`, __dirname, process.cwd());
8-
fs.symlinkSync(
9-
path.resolve(`./cpp/${p}`),
10-
path.resolve(`./android/cpp/${p}`),
11-
"dir"
12-
);
8+
const srcDir = path.resolve(`./cpp/${p}`);
9+
const dstDir = path.resolve(`./android/cpp/${p}`);
10+
11+
if (fs.existsSync(dstDir)) {
12+
fs.unlinkSync(dstDir);
13+
}
14+
15+
fs.symlinkSync(srcDir, dstDir, "dir");
1316
};
1417

1518
// Copy common cpp files from the package root to the android folder

0 commit comments

Comments
 (0)