[jira] [Comment Edited] (CB-14033) `cordova plugin add` skips directory on windows

2018-06-27 Thread Raphael (JIRA)


[ 
https://issues.apache.org/jira/browse/CB-14033?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16525725#comment-16525725
 ] 

Raphael edited comment on CB-14033 at 6/27/18 11:29 PM:


Could you please check if the fix in 
[https://github.com/apache/cordova-lib/pull/621] resolves your problems? If you 
need help installing Cordova from source, let us know.


was (Author: raphinesse):
Could you check if the fix in [https://github.com/apache/cordova-lib/pull/621] 
resolves your problems? If you need help installing Cordova from source, let us 
know.

> `cordova plugin add` skips directory on windows
> ---
>
> Key: CB-14033
> URL: https://issues.apache.org/jira/browse/CB-14033
> 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:#33}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:#33} on windows{color}. The source is 
> {color:#33}[https://github.com/apache/cordova-lib/blob/master/src/plugman/fetch.js#L299]{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:#33}relPath{color} will be "..\t\plugins\plugin 
> id", {color:#33}relativeRootFolder{color} be "..", then 
> {color:#33}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
(v7.6.3#76005)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Comment Edited] (CB-14033) `cordova plugin add` skips directory on windows

2018-06-27 Thread Raphael (JIRA)


[ 
https://issues.apache.org/jira/browse/CB-14033?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16522597#comment-16522597
 ] 

Raphael edited comment on CB-14033 at 6/27/18 11:27 PM:


I see you are using Cordova 6. This version is no longer supported.


was (Author: raphinesse):
I see you are using Cordova 6. This version is no longer supported. Please 
check if the issue persists in cordova@nightly and let us know.

> `cordova plugin add` skips directory on windows
> ---
>
> Key: CB-14033
> URL: https://issues.apache.org/jira/browse/CB-14033
> 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:#33}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:#33} on windows{color}. The source is 
> {color:#33}[https://github.com/apache/cordova-lib/blob/master/src/plugman/fetch.js#L299]{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:#33}relPath{color} will be "..\t\plugins\plugin 
> id", {color:#33}relativeRootFolder{color} be "..", then 
> {color:#33}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
(v7.6.3#76005)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org