O'Reilly logo

Adobe® AIR™ Bible by Jeff Yamada, Ryan Taylor, Benjamin Gorton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8. Using the Filesystem

One of the most useful features in AIR is the ability to work with the local filesystem. Unlike the Flash Player, whose security model is appropriately much stricter and prohibits writing and manipulating files both server side and client side directly, AIR has the ability to interact directly with files.

You can perform some simple tasks using the filesystem, including using configuration files, using log files to record errors and events, inspecting directories and files, and storing user specific data. The filesystem package offers the ability to provide an application with more complex tasks, such as generating files based on user interactions. This opens the door for the development of applications like word processors, sound editors, image editors, and a whole host of applications yet to be made.

Filesystem Basics

AIR provides a relatively robust set of tools for interacting with the filesystem. These tools are exposed in the class package flash.filesystem, which contains three classes: File, FileStream, and FileMode. Combined, these classes provide features that allow developers to perform tasks such as reading, writing, moving, copying, and deleting files. There are no classes specifically meant for handling directories alone. Because most of the functionality such as copying, moving, deleting, renaming, and creating pertains to files already, the directory handling was rolled into the File handling.

Tip

Use File.isDirectory to differentiate between ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required