Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //-----------------------------------
- // Retrieve application version from metadata.
- //
- static public function getAppVersion():String {
- // The alternative to this mess is to use File.userDirectory, but I don't consider
- // that guaranteed to always point to the parent of app/META-INF
- var manifest:File = new File(File.applicationDirectory.nativePath).resolvePath('../META-INF/MANIFEST.MF');
- var file:FileStream = new FileStream();
- file.open(manifest, FileMode.READ);
- var text:String = file.readUTFBytes(Math.min(manifest.size, 1000));
- return /Application-Version: (.+)/i.exec(text)[1];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement