xwielder
09-13-2007, 04:30 PM
Flash CS3
Adobe AIR Beta 1
// All three (3) AIR import classes are needed to handle commonly used file/directory manipulations.
import flash.filesystem.File; // Represents a path to a file or directory.
import flash.filesystem.FileStream; // Used to open files for reading/writing.
import flash.filesystem.FileMode; // Determines the capabilities available to the FileStream object once the file is opened, which include writing, reading, appending, and updating.
// WORKING WITH DIRECTORIES (create, delete, move, list)
//
// **!~ NOTE ~!**
// ************************************************** ********************
// A File object can point to the path of a file or directory that does NOT YET EXIST.
// You can use such a File object in creating a new file or directory.
// ************************************************** ********************
//
// ** CREATE a Directory using a specific (explicit) path.
//
////////////////////////////////////////////////////////
// Create the File object variable
var testNativeDIR:File = new File();
// Set the (native) path for the File object.
// MUST use double '\\' back OR forward slashes. ("\\" OR "//" will work.)
testNativeDIR.nativePath = "C:\\_TEST-DIRECTORY";
// Create the Directory (based on the native path data).
testNativeDIR.createDirectory();
//
//
// ** CREATE a Directory in the User directory of the logged on user.
// Example: "C:\Documents and Settings\username"
//
////////////////////////////////////////////////////////
// Create and assign the File object variable.
var testUserDIR:File = File.userDirectory.resolve("_TEST-DIRECTORY");
// Create the Directory.
testUserDIR.createDirectory();
//
//
// ** CREATE a Directory in the 'My Documents' folder of the logged on user .
// Example: "C:\Documents and Settings\username\My Documents"
//
////////////////////////////////////////////////////////
// Create and assign the File object variable.
var testDocumentsDIR:File = File.documentsDirectory.resolve("_TEST-DIRECTORY");
// Create the Directory.
testDocumentsDIR.createDirectory();
//
//
// ** CREATE a Directory on the Desktop of the logged on user .
// Example: "C:\Documents and Settings\username\Desktop"
//
////////////////////////////////////////////////////////
// Create and assign the File object variable.
var testDesktopDIR:File = File.desktopDirectory.resolve("_TEST-DIRECTORY");
// Create the Directory.
testDesktopDIR.createDirectory();
//
//
// ** CREATE a Directory in the root of where the AIR application was installed.
//
////////////////////////////////////////////////////////
// Create the File object variable.
var testAppResDIR:File = File.applicationResourceDirectory;
// Name the Directory.
testAppResDIR = testAppResDIR.resolve("_TEST-RESOURCE-DIRECTORY");
// Create the Directory.
testAppResDIR.createDirectory();
//
//
// ** CREATE a Directory to store prefs and such.
//
////////////////////////////////////////////////////////
// Create the File object variable.
var testAppStoreDIR:File = File.applicationStorageDirectory;
// Name the Directory.
testAppStoreDIR = testAppStoreDIR.resolve("_TEST-STORAGE-DIRECTORY");
// Create the Directory.
testAppStoreDIR.createDirectory();
Okay, the above code will generate all my lovely file directories... except for one. This one:
//
//
// ** CREATE a Directory to store prefs and such.
//
////////////////////////////////////////////////////////
// Create the File object variable.
var testAppStoreDIR:File = File.applicationStorageDirectory;
// Name the Directory.
testAppStoreDIR = testAppStoreDIR.resolve("_TEST-STORAGE-DIRECTORY");
// Create the Directory.
testAppStoreDIR.createDirectory();
Adobe say's this:
You can point a File object to the application storage directory. For every AIR application, there is a unique associated path that defines the application store directory. You may want to use this directory to store application-specific data (such as user data or preferences files).
Where is this unique associated path ?!?
I do a computer wide search for _TEST-STORAGE-DIRECTORY to no avail. What am I missing?
Adobe AIR Beta 1
// All three (3) AIR import classes are needed to handle commonly used file/directory manipulations.
import flash.filesystem.File; // Represents a path to a file or directory.
import flash.filesystem.FileStream; // Used to open files for reading/writing.
import flash.filesystem.FileMode; // Determines the capabilities available to the FileStream object once the file is opened, which include writing, reading, appending, and updating.
// WORKING WITH DIRECTORIES (create, delete, move, list)
//
// **!~ NOTE ~!**
// ************************************************** ********************
// A File object can point to the path of a file or directory that does NOT YET EXIST.
// You can use such a File object in creating a new file or directory.
// ************************************************** ********************
//
// ** CREATE a Directory using a specific (explicit) path.
//
////////////////////////////////////////////////////////
// Create the File object variable
var testNativeDIR:File = new File();
// Set the (native) path for the File object.
// MUST use double '\\' back OR forward slashes. ("\\" OR "//" will work.)
testNativeDIR.nativePath = "C:\\_TEST-DIRECTORY";
// Create the Directory (based on the native path data).
testNativeDIR.createDirectory();
//
//
// ** CREATE a Directory in the User directory of the logged on user.
// Example: "C:\Documents and Settings\username"
//
////////////////////////////////////////////////////////
// Create and assign the File object variable.
var testUserDIR:File = File.userDirectory.resolve("_TEST-DIRECTORY");
// Create the Directory.
testUserDIR.createDirectory();
//
//
// ** CREATE a Directory in the 'My Documents' folder of the logged on user .
// Example: "C:\Documents and Settings\username\My Documents"
//
////////////////////////////////////////////////////////
// Create and assign the File object variable.
var testDocumentsDIR:File = File.documentsDirectory.resolve("_TEST-DIRECTORY");
// Create the Directory.
testDocumentsDIR.createDirectory();
//
//
// ** CREATE a Directory on the Desktop of the logged on user .
// Example: "C:\Documents and Settings\username\Desktop"
//
////////////////////////////////////////////////////////
// Create and assign the File object variable.
var testDesktopDIR:File = File.desktopDirectory.resolve("_TEST-DIRECTORY");
// Create the Directory.
testDesktopDIR.createDirectory();
//
//
// ** CREATE a Directory in the root of where the AIR application was installed.
//
////////////////////////////////////////////////////////
// Create the File object variable.
var testAppResDIR:File = File.applicationResourceDirectory;
// Name the Directory.
testAppResDIR = testAppResDIR.resolve("_TEST-RESOURCE-DIRECTORY");
// Create the Directory.
testAppResDIR.createDirectory();
//
//
// ** CREATE a Directory to store prefs and such.
//
////////////////////////////////////////////////////////
// Create the File object variable.
var testAppStoreDIR:File = File.applicationStorageDirectory;
// Name the Directory.
testAppStoreDIR = testAppStoreDIR.resolve("_TEST-STORAGE-DIRECTORY");
// Create the Directory.
testAppStoreDIR.createDirectory();
Okay, the above code will generate all my lovely file directories... except for one. This one:
//
//
// ** CREATE a Directory to store prefs and such.
//
////////////////////////////////////////////////////////
// Create the File object variable.
var testAppStoreDIR:File = File.applicationStorageDirectory;
// Name the Directory.
testAppStoreDIR = testAppStoreDIR.resolve("_TEST-STORAGE-DIRECTORY");
// Create the Directory.
testAppStoreDIR.createDirectory();
Adobe say's this:
You can point a File object to the application storage directory. For every AIR application, there is a unique associated path that defines the application store directory. You may want to use this directory to store application-specific data (such as user data or preferences files).
Where is this unique associated path ?!?
I do a computer wide search for _TEST-STORAGE-DIRECTORY to no avail. What am I missing?