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

ASF GitHub Bot commented on CB-10706:
-------------------------------------

GitHub user Reon90 opened a pull request:

    https://github.com/apache/cordova-plugin-file/pull/193

    CB-10706: (windows) fix ENCODING_ERR for applicationDirectory

    <!--
    Please make sure the checklist boxes are all checked before submitting the 
PR. The checklist
    is intended as a quick reference, for complete details please see our 
Contributor Guidelines:
    
    http://cordova.apache.org/contribute/contribute_guidelines.html
    
    Thanks!
    -->
    
    ### Platforms affected
    windows
    
    ### What does this PR do?
    add support to reading files from application directory
    
    ### What testing has been done on this change?
    without testing
    
    ### Checklist
    - [+] [ICLA](http://www.apache.org/licenses/icla.txt) has been signed and 
submitted to [email protected].
    - [+] [Reported an issue](http://cordova.apache.org/contribute/issues.html) 
in the JIRA database
    - [+] Commit message follows the format: "CB-3232: (android) Fix bug with 
resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform 
affected.
    - [+] Added automated test coverage as appropriate for this change.
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/Reon90/cordova-plugin-file master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-plugin-file/pull/193.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #193
    
----
commit a4df917e66d0c35cb3e11ca3257f54b8b7dd3eab
Author: Reon90 <[email protected]>
Date:   2016-08-25T20:25:49Z

    fix ENCODING_ERR for applicationDirectory

----


> ms-appx:/// does not seem to work to copy folders/files from appx content...
> ----------------------------------------------------------------------------
>
>                 Key: CB-10706
>                 URL: https://issues.apache.org/jira/browse/CB-10706
>             Project: Apache Cordova
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>          Components: Plugin File, Windows
>         Environment: Windows 10 Mobile, Phonegap 5.3.6, cordova-plugin-file 
> 4.1.0 "File"
>            Reporter: Fuchur84
>              Labels: triaged, wfc
>
> This is the code I am trying to use to copy some files from the www-folder of 
> the app to the storage of the smartphone.
> For Android and iOS everything is working, but for Windows 10 Mobile 
> (neighter with "file://"... nor with "ms-appx:///"), I get 
> "copy_data_from_local(0): Default-Folder ms-appx:///www/data/0 not available. 
> 5"
> function copy_data_from_local(){
>     if(window.system_type != 'windows'){ // this can hold windows, android or 
> ios in it.
>         // android or ios
>         var default_folder = "file://" + 
> (window.location.pathname).split('index.html').join('') + "data/0";
>         var default_data_file = "file://" + 
> (window.location.pathname).split('index.html').join('') + "data/data.txt";
>     } else {
>         // windows... file:// does not work here, so try it with ms-appx://
>         var default_folder = "ms-appx:///www/data/0"; // THESE DO NOT WORK 
> FOR WINDOWS... I AM NOT SURE WHY!
>         var default_data_file = "ms-appx:///www/data/data.txt";
>     }
>     window.requestFileSystem = window.wrfs; // this is already available.
>     // window.file_path is the folder of the app in app-data... this works.
>     window.resolveLocalFileSystemURL(window.file_path, function(main_dir){
>         window.resolveLocalFileSystemURL(default_folder, function(dir){
>             dir.copyTo(main_dir, '0', function (new_dir){
>                 // default_data has been_copied: success
>                 window.resolveLocalFileSystemURL(default_data_file, 
> function(data_file){
>                     console.log("copy_data_from_local(-2): Default-data_file 
> is available.");
>                     // default_data-file is available
>                     data_file.copyTo(main_dir, 'data.txt', function (){
>                         // default_data-file has been_copied: success
>                         console.log("copy_data_from_local(1): 
> Default-data_file has been copied.");
>                         get_file_contents(window.file_path + "data.txt", 
> function() {
>                             update_data_now();
>                         }, function (error) {
>                             console.log("copy_data_from_local(3): 
> Default-Data-File could not be copied. " + error.code);
>                         });
>                     }, function (error) {
>                     console.log("copy_data_from_local(4): Data could not be 
> read. " + error.code);
>                     });
>                 }, function (error) {
>                     console.log("copy_data_from_local(4): Data could not be 
> read. " + error.code);
>                 });
>             },
>             function (e) {
>                 console.log("copy_data_from_local(2): Default-directory could 
> not be copied: " + e.code);
>             });
>         }, function (error) {
>             // this seems to be firing on windows...
>             console.log('copy_data_from_local(0): Default-Folder ' + 
> default_folder + ' not available. ' + error.code);
>         });
>     }, function (error) {
>         console.log('copy_data_from_local(-1): Parent-Folder ' + 
> window.file_path + ' not available. ' + error.code);
>     });
> }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to