cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (CB-14033) `cordova plugin add` skips directory on windows
Date Wed, 04 Jul 2018 17:52:00 GMT


ASF GitHub Bot commented on CB-14033:

raphinesse commented on issue #621: CB-14033 Support symbolic dir links on Windows
   @brodybits Since there is a test that specifically targets the changed code, I'm quite
confident it's OK.
   However, some real-world testing is always good. Thanks for taking care of it :+1: 

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

> `cordova plugin add` skips directory on windows
> -----------------------------------------------
>                 Key: CB-14033
>                 URL:
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-lib
>         Environment: Cordova 6.2.0
>            Reporter: Jack Lu
>            Assignee: Raphael
>            Priority: Major
> Suppose we have a cordova plugin project and a test project that are under the same directory.
The {color:#333333}cordova plugin project {color}is in directory p, and the test project
in directory t. When I run following command in directory t:
> {code:java}
> cordova plugin add ..\p
> {code}
> the install fails, and I found it's due to the src directory missing during copying.
> After digging into the source, I found it's caused by a special handling in the fetch
action{color:#333333} on windows{color}. The source is {color:#333333}[]{color}.
> {code:java}
>             /*
>                 [CB-10423]
>                 This is a special case. On windows we cannot create a symlink unless
we are run as admin
>                 The error that we have is because src contains dest, so we end up with
a recursive folder explosion
>                 This code avoids copy the one folder that will explode, and allows plugins
to contain a demo project
>                 and to install the plugin via `cordova plugin add ../`
>             */
>             var resolvedSrcPath = path.resolve(plugin_dir);
>             var filenames = fs.readdirSync(resolvedSrcPath);
>             var relPath = path.relative(resolvedSrcPath,dest);
>             var relativeRootFolder = relPath.split('\\')[0];
>             filenames.splice(filenames.indexOf(relativeRootFolder),1);
> {code}
> in this case {color:#333333}relPath{color} will be "..\t\plugins\{{{{plugin id}}}}", {color:#333333}relativeRootFolder{color}
be "..", then {color:#333333}filenames.indexOf(relativeRootFolder){color} be -1, finally filenames
lost the last element, which is the src directory in my case.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message