Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26149] Android: Ti.Filesystem.File#getDirectoryListing() does not return null for file/non-existent directory

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2018-08-24T01:29:51.000+0000
Affected Version/sRelease 7.3.0
Fix Version/sRelease 7.5.0
ComponentsAndroid
Labelsparity
ReporterChristopher Williams
AssigneeChristopher Williams
Created2018-06-22T15:13:52.000+0000
Updated2018-08-24T01:29:54.000+0000

Description

According to our docs, and our iOS behavior - if Ti.FIlesystem.File#getDirectoryListing() is called on a file or a directory that does not exist, it should return null. On Android it returns an empty array.

Comments

  1. Christopher Williams 2018-06-22

    https://github.com/appcelerator/titanium_mobile/pull/10128
  2. Samir Mohammed 2018-08-14

    *Closing ticket.* Verified fix in SDK version: 7.4.0.v20180810061237. getDirectoryListing no longer returns an empty array and now returns null. *FR Passed (Test Steps):*

    Created a new application using Titanium

    Added the following code in to the application

       var nonExistentDir = Ti.Filesystem.getFile('madeup');
       Ti.API.info(nonExistentDir.getDirectoryListing()); // Should print 'null'
       var file = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'app.js');
       Ti.API.info(file.getDirectoryListing());  // Should print 'null'
       

    Ran the application

    Able to see null printed in the console unlike previously where an empty array was printed.

       [INFO] :   null
       [INFO] :   null
       
    *Test Environment*
       APPC Studio: 5.1.0.201808080937
       APPC CLI: 7.0.4
       Pixel XL (8.1)
       Operating System Name: Mac OS High Sierra
       Operating System Version: 10.13
       Node.js Version: 8.9.1
       Xcode 9.2
       
  3. Samir Mohammed 2018-08-14

    *Edit* SDK Version: 7.4.0.v20180813131247 was used.

JSON Source