mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-20 23:56:20 +08:00
CB-11683 Fixed linking to directories during plugin installation.
This closes #322
This commit is contained in:
parent
d54a42f0f0
commit
db6295c917
13
bin/templates/cordova/lib/pluginHandlers.js
vendored
13
bin/templates/cordova/lib/pluginHandlers.js
vendored
@ -214,10 +214,17 @@ function copyFile (plugin_dir, src, project_dir, dest, link) {
|
||||
throw new CordovaError('Destination "' + dest + '" for source file "' + src + '" is located outside the project');
|
||||
|
||||
shell.mkdir('-p', path.dirname(dest));
|
||||
|
||||
var srcStat = fs.statSync(src);
|
||||
if (link) {
|
||||
fs.symlinkSync(path.relative(path.dirname(dest), src), dest);
|
||||
} else if (fs.statSync(src).isDirectory()) {
|
||||
//CB-11683 We need to handle linking to directories on our own because Windows doesn't.
|
||||
var type;
|
||||
if (srcStat.isDirectory()) {
|
||||
type = 'dir';
|
||||
} else {
|
||||
type = 'file';
|
||||
}
|
||||
fs.symlinkSync(path.relative(path.dirname(dest), src), dest, type);
|
||||
} else if (srcStat.isDirectory()) {
|
||||
// XXX shelljs decides to create a directory when -R|-r is used which sucks. http://goo.gl/nbsjq
|
||||
shell.cp('-Rf', src+'/*', dest);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user