[jira] [Commented] (CB-5774) Windows 8: DirectoryReader returns isFile = true for directories

2014-01-15 Thread Matti Eerola (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-5774?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13872564#comment-13872564
 ] 

Matti Eerola commented on CB-5774:
--

results\[i\].isDirectory is false.

I think I have found the reason for this error. Folder query in FileProxy.js 
readEntries-function  created FileEntry object instead of DirectoryEntry object.

This fixed the error in my use case:
https://github.com/spMatti/cordova-plugin-file/commit/9b290353eca2bd64e5deabbb75487052281100ea

 Windows 8: DirectoryReader returns isFile = true for directories
 

 Key: CB-5774
 URL: https://issues.apache.org/jira/browse/CB-5774
 Project: Apache Cordova
  Issue Type: Bug
  Components: Plugin File, Windows 8
Affects Versions: 3.3.0
 Environment: Windows 8.0
Reporter: Matti Eerola
Assignee: Jesse MacFadyen
Priority: Minor

 All entries returned by DirectoryReader.readEntries have isFile set to true.
 The expected result is that directories have isFile:false and 
 isDirectory:true.
 Here is a code sample that will show the error:
 {code:javascript}
   window.requestFileSystem(LocalFileSystem.PERSISTENT, 5 * 1024 * 1024 * 
 1024, function (fs) {
 //Ensure that there is one directory in the root
 fs.root.getDirectory('foo', { create: true }, function (newDir) {
   //Use reader to get the directory
   var reader = fs.root.createReader();
   reader.readEntries(function (results) {
 for (var i = 0; i  results.length; i++) {
   if (results[i].name != foo)
 continue;
   // foo should be directory
   if (results[i].isFile)
 throw 'foo' is a directory and isFile is true;
 }
   });
 });
   });
 {code}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (CB-5774) Windows 8: DirectoryReader returns isFile = true for directories

2014-01-15 Thread Matti Eerola (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-5774?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13872585#comment-13872585
 ] 

Matti Eerola commented on CB-5774:
--

It's so small that you can just make the change.

 Windows 8: DirectoryReader returns isFile = true for directories
 

 Key: CB-5774
 URL: https://issues.apache.org/jira/browse/CB-5774
 Project: Apache Cordova
  Issue Type: Bug
  Components: Plugin File, Windows 8
Affects Versions: 3.3.0
 Environment: Windows 8.0
Reporter: Matti Eerola
Assignee: Jesse MacFadyen
Priority: Minor

 All entries returned by DirectoryReader.readEntries have isFile set to true.
 The expected result is that directories have isFile:false and 
 isDirectory:true.
 Here is a code sample that will show the error:
 {code:javascript}
   window.requestFileSystem(LocalFileSystem.PERSISTENT, 5 * 1024 * 1024 * 
 1024, function (fs) {
 //Ensure that there is one directory in the root
 fs.root.getDirectory('foo', { create: true }, function (newDir) {
   //Use reader to get the directory
   var reader = fs.root.createReader();
   reader.readEntries(function (results) {
 for (var i = 0; i  results.length; i++) {
   if (results[i].name != foo)
 continue;
   // foo should be directory
   if (results[i].isFile)
 throw 'foo' is a directory and isFile is true;
 }
   });
 });
   });
 {code}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Created] (CB-5774) Windows 8: DirectoryReader returns isFile = true for directories

2014-01-11 Thread Matti Eerola (JIRA)
Matti Eerola created CB-5774:


 Summary: Windows 8: DirectoryReader returns isFile = true for 
directories
 Key: CB-5774
 URL: https://issues.apache.org/jira/browse/CB-5774
 Project: Apache Cordova
  Issue Type: Bug
  Components: Plugin File, Windows 8
Affects Versions: 3.3.0
 Environment: Windows 8.0
Reporter: Matti Eerola
Assignee: Jesse MacFadyen
Priority: Minor


All entries returned by DirectoryReader.readEntries have isFile set to true.

The expected result is that directories have isFile:false and isDirectory:true.

Here is a code sample that will show the error:
{code:javascript}
  window.requestFileSystem(LocalFileSystem.PERSISTENT, 5 * 1024 * 1024 * 
1024, function (fs) {
//Ensure that there is one directory in the root
fs.root.getDirectory('foo', { create: true }, function (newDir) {
  //Use reader to get the directory
  var reader = fs.root.createReader();
  reader.readEntries(function (results) {
for (var i = 0; i  results.length; i++) {
  if (results[i].name != foo)
continue;

  // foo should be directory
  if (results[i].isFile)
throw 'foo' is a directory and isFile is true;
}
  });
});
  });
{code}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (CB-5747) Windows 8: DirectoryEntry.getDirectory fails when path contains directory separator

2014-01-11 Thread Matti Eerola (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-5747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13868881#comment-13868881
 ] 

Matti Eerola commented on CB-5747:
--

A quick fix can be found here:
https://github.com/spMatti/cordova-plugin-file/commit/3e4f9cdc287d907679a47a32f95238180c774860

 Windows 8: DirectoryEntry.getDirectory fails when path contains directory 
 separator
 ---

 Key: CB-5747
 URL: https://issues.apache.org/jira/browse/CB-5747
 Project: Apache Cordova
  Issue Type: Bug
  Components: Plugin File, Windows 8
Affects Versions: 3.3.0
 Environment: Windows 8.0 
Reporter: Matti Eerola
Assignee: Jesse MacFadyen
Priority: Minor

 Code:
 {code:javascript}
   window.requestFileSystem(LocalFileSystem.PERSISTENT, 5*1024*1024*1024, 
 function(fs){
 fs.root.getDirectory('foo/bar', {create:true}, function(newDir){
 });
   });
 {code}
 Problem:
 The directory separator for File Api is '/' (U+002F). So 'foo/bar' argument 
 should be correct. src/windows8/FileProxy.js passes path attribute directly 
 to storageFolder.createFolderAsync that uses backslash '\' (U+005c) as 
 directory separator. The result is invalid path error from createFolderAsync.
 This code works, but is nonstandard:
 {code:javascript}
   window.requestFileSystem(LocalFileSystem.PERSISTENT, 5*1024*1024*1024, 
 function(fs){
 fs.root.getDirectory('foo\\bar', {create:true}, function(newDir){
 });
   });
 {code}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Created] (CB-5747) Windows 8: DirectoryEntry.getDirectory fails when path contains directory separator

2014-01-08 Thread Matti Eerola (JIRA)
Matti Eerola created CB-5747:


 Summary: Windows 8: DirectoryEntry.getDirectory fails when path 
contains directory separator
 Key: CB-5747
 URL: https://issues.apache.org/jira/browse/CB-5747
 Project: Apache Cordova
  Issue Type: Bug
  Components: Plugin File, Windows 8
Affects Versions: 3.3.0
 Environment: Windows 8.0 
Reporter: Matti Eerola
Assignee: Jesse MacFadyen
Priority: Minor


Code:
  window.requestFileSystem(LocalFileSystem.PERSISTENT, 5*1024*1024*1024, 
function(fs){
fs.root.getDirectory('foo/bar', {create:true}, function(newDir){

});
  });

Problem:
The directory separator for File Api is '/' (U+002F). So 'foo/bar' argument 
should be correct. src/windows8/FileProxy.js passes path attribute directly to 
storageFolder.createFolderAsync that uses backslash '\' (U+005c) as directory 
separator. The result is invalid path error from createFolderAsync.

This code works, but is nonstandard:
  window.requestFileSystem(LocalFileSystem.PERSISTENT, 5*1024*1024*1024, 
function(fs){
fs.root.getDirectory('foo\\bar', {create:true}, function(newDir){

});
  });



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Updated] (CB-5747) Windows 8: DirectoryEntry.getDirectory fails when path contains directory separator

2014-01-08 Thread Matti Eerola (JIRA)

 [ 
https://issues.apache.org/jira/browse/CB-5747?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Matti Eerola updated CB-5747:
-

Description: 
Code:
{code:javascript}
  window.requestFileSystem(LocalFileSystem.PERSISTENT, 5*1024*1024*1024, 
function(fs){
fs.root.getDirectory('foo/bar', {create:true}, function(newDir){

});
  });
{code}

Problem:
The directory separator for File Api is '/' (U+002F). So 'foo/bar' argument 
should be correct. src/windows8/FileProxy.js passes path attribute directly to 
storageFolder.createFolderAsync that uses backslash '\' (U+005c) as directory 
separator. The result is invalid path error from createFolderAsync.

This code works, but is nonstandard:
{code:javascript}
  window.requestFileSystem(LocalFileSystem.PERSISTENT, 5*1024*1024*1024, 
function(fs){
fs.root.getDirectory('foo\\bar', {create:true}, function(newDir){

});
  });
{code}

  was:
Code:
  window.requestFileSystem(LocalFileSystem.PERSISTENT, 5*1024*1024*1024, 
function(fs){
fs.root.getDirectory('foo/bar', {create:true}, function(newDir){

});
  });

Problem:
The directory separator for File Api is '/' (U+002F). So 'foo/bar' argument 
should be correct. src/windows8/FileProxy.js passes path attribute directly to 
storageFolder.createFolderAsync that uses backslash '\' (U+005c) as directory 
separator. The result is invalid path error from createFolderAsync.

This code works, but is nonstandard:
  window.requestFileSystem(LocalFileSystem.PERSISTENT, 5*1024*1024*1024, 
function(fs){
fs.root.getDirectory('foo\\bar', {create:true}, function(newDir){

});
  });


added formatting

 Windows 8: DirectoryEntry.getDirectory fails when path contains directory 
 separator
 ---

 Key: CB-5747
 URL: https://issues.apache.org/jira/browse/CB-5747
 Project: Apache Cordova
  Issue Type: Bug
  Components: Plugin File, Windows 8
Affects Versions: 3.3.0
 Environment: Windows 8.0 
Reporter: Matti Eerola
Assignee: Jesse MacFadyen
Priority: Minor

 Code:
 {code:javascript}
   window.requestFileSystem(LocalFileSystem.PERSISTENT, 5*1024*1024*1024, 
 function(fs){
 fs.root.getDirectory('foo/bar', {create:true}, function(newDir){
 });
   });
 {code}
 Problem:
 The directory separator for File Api is '/' (U+002F). So 'foo/bar' argument 
 should be correct. src/windows8/FileProxy.js passes path attribute directly 
 to storageFolder.createFolderAsync that uses backslash '\' (U+005c) as 
 directory separator. The result is invalid path error from createFolderAsync.
 This code works, but is nonstandard:
 {code:javascript}
   window.requestFileSystem(LocalFileSystem.PERSISTENT, 5*1024*1024*1024, 
 function(fs){
 fs.root.getDirectory('foo\\bar', {create:true}, function(newDir){
 });
   });
 {code}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)