AntBirch AntBirch - 2 months ago 12
ActionScript Question

AS3 File.documentsDirectory doesn't exist?

Currently have an issue where I'm copying a file to File.documentsDirectory before loading it into my application but one user of the application doesn't have a local Documents directory as it's mapped to a server.

Is there any way I can get around this? Maybe I could check if the documents directory exists and then save to the desktop if so?

The file/folder that is saved needs to be easily accessible but ideally not on the Desktop as this is just asking for more issues.


You can easily check if a directory or file exists with the exists property of a File object:

var file:File;

    file = File.documentsDirectory;
}else if(File.desktopDirectory.exists) {
    file = File.desktopDirectory;
}else {
    //let the user pick the directory with FileReference class or save in File.applicationStorageDirectory