I read a XML file, edit it and save again:
var filePath:String = File.applicationDirectory.resolvePath("alerts.xml").nativePath;
var file:File = new File(filePath);
var fs:FileStream = new FileStream();
var xml:XML = XML(fs.readUTFBytes(fs.bytesAvailable));
xml[key] = value;
When I´m in debug mode, everything is fine, but when I generate a Executable installer (native installer), it doesn´t work.
I don´t have permission.
That's explicitely marked in documentation to not use "applicationDirectory" for write (updates/modification/deletion/etc), e.g.:
The File class includes static properties that let you reference commonly used directory locations. These static properties include:
File.applicationStorageDirectory—a storage directory unique to each installed AIR application
File.applicationDirectory—the read-only directory where the application is installed (along with any installed assets)
and later on the same page:
Modifying content in the application directory is a bad practice, for security reasons, and is blocked by the operating system on some platforms. If you want to store application-specific data, consider using the application storage directory (File.applicationStorageDirectory).
So as pointed in docs you could use applicationStorageDirectory as location where you application-specific content is to be stored/created/updated/written/etc.
(otherwise everything works fine when running local ADT/debug session - but it could fail at any time when deployed)