gaurav flex
gaurav flex

Reputation:

flex air include a directory with the installer

I am creating an AIR application using Flex. In it I need 2 directories downloads & uploads. These directories will have downloaded files & uploaded files. But the problem is I am not able to create these 2 directories programmatically & also I am not able to include the 2 directories with the installer in the application directory.

Is there any way to create or include directories in the application directory.

Thanks

Upvotes: 2

Views: 3596

Answers (6)

Yury Euceda
Yury Euceda

Reputation: 566

I just want to add another thing to johncblandii's comment: Create an empty.txt file and write something there. Because it looks like empty folders are nod allowed to be included in your packed application

Upvotes: 0

mishonis
mishonis

Reputation: 1

To add to johncblandii's anwser: I've found that for the above to work, you also need to include the folder in the project's build path. I also had to refresh the project's file listing before flash builder recognized the folder and added it to the include options.

Upvotes: 0

Ali Naqvi
Ali Naqvi

Reputation: 11

Use This Dear :)

var dir:File = File.applicationDirectory.resolvePath("NewFolder");

dir =new File(dir.nativePath.toString());
dir.createDirectory();

Regards

Ali Naqvi

Upvotes: 1

johncblandii
johncblandii

Reputation: 378

Create an empty folder inside your Flex project. Right click on your project and go to Properties->Compiler (not exact name but something like that). Make sure it has "Copy nonembedded assets to output directory" (check it if it doesn't). Click Ok.

Export a release build of your AIR app. Do NOT click Finish after the "signing" step. Follow each step until you get to the "assets" screen. It will show you a list of every file and folder in your output (bin-debug, by default) directory.

Check the files you want, uncheck the one's you don't, and click OK. Done. You have your AIR file packaged with whatever file and folder you want.

Upvotes: 2

dirkgently
dirkgently

Reputation: 111150

[...] But I need to create the directories in application directory. I am using: var dir = File.applicationDirectory.resolvePath("upload directory");dir.createDirectory(); And I am getting: at runtime::SecurityManager$/checkPrivilegeForCaller()

This is a know issue. AIR wouldn't allow you to write to the application directory. Instead try writing

  • either to the File.applicationStorageDirectory (application's scratchpad),
  • or to the File.documentsDirectory (stuff user might want to lookup)

Related resources:

Adobe AIR team blogpost

Upvotes: 1

kenneth
kenneth

Reputation: 1065

have you tried something like the following

var dir = File.userDirectory.resolvePath("upload directory");
dir.createDirectory();

This will create the directory 'upload directory' if it does not already exist (inside the users home directory).

Upvotes: 0

Related Questions