[
https://issues.apache.org/jira/browse/CB-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jesse MacFadyen resolved CB-4054.
---------------------------------
Resolution: Fixed
Fix Version/s: 3.1.0
Resolved along with CB-4421
> WP8 file requests are not relative to www folder
> ------------------------------------------------
>
> Key: CB-4054
> URL: https://issues.apache.org/jira/browse/CB-4054
> Project: Apache Cordova
> Issue Type: Bug
> Components: Docs, Plugin File, WP8
> Affects Versions: 2.9.0
> Environment: Windows 8 x64
> Reporter: Frederico Costa Galvão
> Assignee: Jesse MacFadyen
> Labels: patch
> Fix For: 3.1.0
>
>
> I started migrating my app (http://tippz.mobi) to *WP8* and found that all
> files requested via js (xhr) are expected to be served relative to the
> project root (at least on development/emulator, but I can't imagine it to be
> different on other environments), which is not according to the way it
> happens on iOS and Android.
> On both iOS and Android, working directory for the code serving files via xhr
> is the 'www' folder (or is it the folder where my 'index.html' is located?),
> while on WP8 it is 'www/..' (the project root, in other words). Resources
> mapped directly on the html file however are served from the right directory
> on all cases.
> There is also no word about it on the docs, the only thing I found was an
> answer on stackoverflow.
> Adding the following code on line 717 of Plugins/File.cs@readResourceAsText()
> solved the problem (so far!, can't be sure it didn't have side effects as I
> could not make my app work well enough on WP8 yet):
> {code:java}
> pathToResource = "www/" + pathToResource;
> {code}
> Also, on the same method and file, +optStrings+ variable is expected to
> always have 5 fields, but everytime I ran my app Visual Studio threw me an
> exception because +optStrings+ never have more than 2 fields. I solved it
> surrounding remaining variables attribution with an if(optStrings.Length>2){}.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira