Shaun
Shaun

Reputation: 2181

Is there a way around using getDirectoryListing() in AS3 for large dirs?

I have an AIR app that imports and parses file data. It works fine when dirs contain around 5000 files, but I have users that have dirs with 300,000-600,000 files in them, and it hangs the UI.

My file parsing code works very efficiently - I have timers and enter frame chunking systems in place to update the UI once the dir has been read, but the initial dir.getDirectoryListing() read hangs the app. I've isolated the hang to

var f1:Array = d1.getDirectoryListing();

Everything else around this line works blistering fast, even parsing 600,000 records.

I could use getDirectoryListingAsync() and display a "Reading your directory. Please wait..." pop up with an animation, but getting the dir listing takes multiple minutes on larger dirs and makes it look like the app has hung.

I've played with having Python handle the file read and sending my AIR app json to parse, but then realised that I would need the end user to install python i.e. not gonna happen.

I've played with trying to select a limited amount of files and multiple dir reads, but they still rely on getDirectoryListing, which introduces the hang.

What are other approaches that I could take please?

Thank you

Upvotes: 0

Views: 49

Answers (0)

Related Questions