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

Joshua Perry edited comment on CB-6383 at 4/8/14 8:33 PM:
----------------------------------------------------------

Looks like the problem is a bug in the {{find}} command in OSX.

The {{SRC_DIR}} variable is set to "www/".

With the find included in OSX it adds an extra slash when you have a slash in 
the find predicate:
{code:none}
$ find "www/"
...
www//res/screen/blackberry/screen-225.png
www//res/screen/ios
www//res/screen/ios/screen-ipad-landscape-2x.png
www//res/screen/ios/screen-ipad-landscape.png
www//res/screen/ios/screen-ipad-portrait-2x.png
www//res/screen/ios/screen-ipad-portrait.png
www//res/screen/ios/screen-iphone-landscape-2x.png
www//res/screen/ios/screen-iphone-landscape.png
www//res/screen/ios/screen-iphone-portrait-2x.png
www//res/screen/ios/screen-iphone-portrait-568h-2x.png
www//res/screen/ios/screen-iphone-portrait.png
www//res/screen/tizen
www//res/screen/tizen/README.md
www//res/screen/webos
www//res/screen/webos/screen-64.png
www//res/screen/windows-phone
www//res/screen/windows-phone/screen-portrait.jpg
www//spec
www//spec/helper.js
...
{code}

With GNU find that extra separator is not included in the output:
{code:none}
$ find "www/"
...
www/res/screen/blackberry/screen-225.png
www/res/screen/ios
www/res/screen/ios/screen-ipad-landscape-2x.png
www/res/screen/ios/screen-ipad-landscape.png
www/res/screen/ios/screen-ipad-portrait-2x.png
www/res/screen/ios/screen-ipad-portrait.png
www/res/screen/ios/screen-iphone-landscape-2x.png
www/res/screen/ios/screen-iphone-landscape.png
www/res/screen/ios/screen-iphone-portrait-2x.png
www/res/screen/ios/screen-iphone-portrait-568h-2x.png
www/res/screen/ios/screen-iphone-portrait.png
www/res/screen/tizen
www/res/screen/tizen/README.md
www/res/screen/webos
www/res/screen/webos/screen-64.png
www/res/screen/windows-phone
www/res/screen/windows-phone/screen-portrait.jpg
www/spec
www/spec/helper.js
...
{code}

The hash variable substitution used to derive "subpath" says "take the value of 
$SRC_DIR (www/) and remove it from the beginning of the value in p". {{p}} in 
the case of GNU find is a path like {{www/spec}} which makes subpath just 
{{spec}} and with OSX find the path is {{www//spec}} which makes subpath 
{{/spec}}.

{code:xml}
for p in $(do_find -type l -print); do
  subpath="${p#$SRC_DIR}"
  ...
done
{code}

A simple fix that will make this work with either version of find would be to 
just change {{SRC_DIR="www/"}} to {{SRC_DIR="www"}}


was (Author: joshperry):
Looks like the problem is a bug in the {{find}} command in OSX.

The {{SRC_DIR}} variable is set to "www/".

With the find included in OSX it adds an extra slash when you have a slash in 
the find predicate:
{code:none}
$ find "www/"
...
www//res/screen/blackberry/screen-225.png
www//res/screen/ios
www//res/screen/ios/screen-ipad-landscape-2x.png
www//res/screen/ios/screen-ipad-landscape.png
www//res/screen/ios/screen-ipad-portrait-2x.png
www//res/screen/ios/screen-ipad-portrait.png
www//res/screen/ios/screen-iphone-landscape-2x.png
www//res/screen/ios/screen-iphone-landscape.png
www//res/screen/ios/screen-iphone-portrait-2x.png
www//res/screen/ios/screen-iphone-portrait-568h-2x.png
www//res/screen/ios/screen-iphone-portrait.png
www//res/screen/tizen
www//res/screen/tizen/README.md
www//res/screen/webos
www//res/screen/webos/screen-64.png
www//res/screen/windows-phone
www//res/screen/windows-phone/screen-portrait.jpg
www//spec
www//spec/helper.js
...
{code}

With GNU find that extra separator is not included in the output:
{code:none}
$ find "www/"
www/res/screen/blackberry/screen-225.png
www/res/screen/ios
www/res/screen/ios/screen-ipad-landscape-2x.png
www/res/screen/ios/screen-ipad-landscape.png
www/res/screen/ios/screen-ipad-portrait-2x.png
www/res/screen/ios/screen-ipad-portrait.png
www/res/screen/ios/screen-iphone-landscape-2x.png
www/res/screen/ios/screen-iphone-landscape.png
www/res/screen/ios/screen-iphone-portrait-2x.png
www/res/screen/ios/screen-iphone-portrait-568h-2x.png
www/res/screen/ios/screen-iphone-portrait.png
www/res/screen/tizen
www/res/screen/tizen/README.md
www/res/screen/webos
www/res/screen/webos/screen-64.png
www/res/screen/windows-phone
www/res/screen/windows-phone/screen-portrait.jpg
www/spec
www/spec/helper.js
{code}

The hash variable substitution used to derive "subpath" says "take the value of 
$SRC_DIR (www/) and remove it from the beginning of the value in p". {{p}} in 
the case of GNU find is a path like {{www/spec}} which makes subpath just 
{{spec}} and with OSX find the path is {{www//spec}} which makes subpath 
{{/spec}}.

{code:xml}
for p in $(do_find -type l -print); do
  subpath="${p#$SRC_DIR}"
  ...
done
{code}

A simple fix that will make this work with either version of find would be to 
just change {{SRC_DIR="www/"}} to {{SRC_DIR="www"}}

> copy-www-build-step.sh is missing a path separator in the destination
> ---------------------------------------------------------------------
>
>                 Key: CB-6383
>                 URL: https://issues.apache.org/jira/browse/CB-6383
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: 3.4.0
>            Reporter: Joshua Perry
>
> In copy-www-build-step.sh anywhere that it generates the `subpath` variable 
> it is removing a required path separator.
> For example:
> {code:xml}
> SRC_DIR="www/"
> DST_DIR="$BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME/www"
> #... snip ...
> for p in $(do_find -type d -print); do
>   subpath="${p#$SRC_DIR}"
>   mkdir "$DST_DIR$subpath" || exit 1
> done
> {code}
> This will find directories like {{www/js/}}, and {{www/css/}}.
> The {{subpath=$\{p#$SRC_DIR\}}} turns these paths into {{js/}} and {{css/}}.
> In the 3rd line, the {{mkdir}} command is taking the {{DST_DIR}} and 
> concatenating it with {{subpath}}... Well, {{DST_DIR}} does not end with a 
> directory separator, and subpath does not start with one. So you get a path 
> like 
> {{/Users/josh/dev/pdk/idsuck/platforms/ios/build/emulator/HelloWorld.app/wwwjs/}}
>  when what you really want is 
> {{/Users/josh/dev/pdk/idsuck/platforms/ios/build/emulator/HelloWorld.app/www/js/}}
> This issue afflicts all 3 places where subpath is generated in the file.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to