You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
961 B

--- ../node/deps/npm/node_modules/cacache/lib/util/move-file.js 2017-10-22 19:30:25.778456404 +0200
+++ ./deps/npm/node_modules/cacache/lib/util/move-file.js 2017-10-22 20:41:18.021337095 +0200
@@ -4,6 +4,7 @@
const BB = require('bluebird')
const chmod = BB.promisify(fs.chmod)
const unlink = BB.promisify(fs.unlink)
+const access = BB.promisify(fs.access)
let move
let pinflight
@@ -18,6 +19,18 @@
// content their own way.
//
// Note that, as the name suggests, this strictly only supports file moves.
+
+
+ // Calling link() on android is not allowed, we get a SELinux security exception
+ if(process.platform === 'android') {
+ return access(dest, fs.constants.F_OK)
+ .catch(err => {
+ if (!move) { move = require('move-concurrently') }
+ return move(src, dest, { BB, fs })
+ .then(() => chmod(dest, '0444'))
+ })
+ }
+
return BB.fromNode(cb => {
fs.link(src, dest, err => {
if (err) {