Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Jun 22, 2018

Conversation

sgtcoolguy
Copy link
Contributor

JIRA: https://jira.appcelerator.org/browse/TIMOB-26149

Description:
Adds unit tests around Ti.Filesystem.File#getDirectoryListing() to confirm behaviors.

  • returns null if it's a file or doe not exist
  • returns an empty Array for an empty directory
  • returns an Array of Strings for a typical directory containing files.

Modifies Android's implementation to match iOS/docs.

…not return null for file/non-existent directory
@cb1kenobi
Copy link
Contributor

I would argue that getDirectoryListing() should throw an Error if the file does not exist. This is what Node.js does for fs.readdirSync().

@sgtcoolguy
Copy link
Contributor Author

@cb1kenobi I would tend to agree, but:

  • I don't think we really throw Errors in our APIs generally
  • That'd be a breaking API change

I was trying to fix parity. If we do want to start making our APIs throw Errors like that, then I think that's a larger architectural design decision that we'd have to move towards over time as it's really a breaking API change (and should be done throughout our APIs, not piecemeal).

@cb1kenobi
Copy link
Contributor

Sounds good. 👍

@build
Copy link
Contributor

build commented Jun 22, 2018

Messages
📖

💾 Here's the generated SDK zipfile.

Generated by 🚫 dangerJS

Copy link
Contributor

@jquick-axway jquick-axway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR: Pass

@sgtcoolguy sgtcoolguy merged commit 402df8e into tidev:master Jun 22, 2018
@sgtcoolguy sgtcoolguy deleted the TIMOB-26149 branch June 22, 2018 19:21
@jquick-axway jquick-axway modified the milestones: 7.4.0, 7.5.0 Aug 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants