[
https://issues.apache.org/jira/browse/CB-10706?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15432366#comment-15432366
]
Artem Kunets commented on CB-10706:
-----------------------------------
the same error code 5
> 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
> 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]