views:

30

answers:

2

I want to generate a Class (.as) file and store it on the users desktop all from the AIR-App.

Someone can describe the best practice method?

Many thx and best regards...

A: 

It's always risky to write to places on the user's computer - the sandbox may not allow you to do it at all, or the user's computer may not have access, or the directory structure may not be what you would expect.

Sometimes, you can have access to the application's directory:

http://blog.crankybit.com/notes-adobe-air-local-data-storage-options/

http://livedocs.adobe.com/flex/3/langref/flash/filesystem/File.html

And you should always be able to shove things directly into encrypted storage:

http://www.adobe.com/devnet/air/ajax/articles/encrypted_local_store.html

eruciform
+1  A: 

Instead of trying to store anything on the desktop; do it on the user's storage directory. You can get the userDirectory using the userDirectory attribute of the File class.

A second approach would be to store your file in the Application's directory with the applicationStorageDirectory attribute.

Using either of these two approaches is what I would consider a best practice. Trying to store elsewhere is not something I'd recommend, as @eruciform stated there may be sandbox issues that prevent you from accessing those other directories.

www.Flextras.com