cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frederico Costa Galvão (JIRA) <>
Subject [jira] [Created] (CB-4054) WP8 file requests are not relative to www folder
Date Sat, 29 Jun 2013 14:43:19 GMT
Frederico Costa Galvão created CB-4054:

             Summary: WP8 file requests are not relative to www folder
                 Key: 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: Michael Brooks

I started migrating my app ( 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):
                pathToResource = "www/" + pathToResource;

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:

View raw message