开发者

How do I get the current filename of an AIR app?

I'm building an AIR app where some functionality depends on renaming the app executable in the filesystem, and detecting whatever name the executable has when it's launched. I don't need to detect changes while the app is running, if that makes any difference, and I don't need the path or extension — just the name.

If the executable was the only item in its folder, I could get the Application Directory from the File class and go from there. But it would be ideal to have a solution where there may be more than one copy of this AIR executable in a folder, each renamed to something unique.

I've looked at the NativeApplication class, the System class, the File class, and any other class that seems related to this issue, to no avail. The closest I've come is getting the Filename from the Application Descriptor XML, but that only reflects the default name the application is given when published.

So, how I can get the exact current filename of an AIR app at launch?

EDIT: To be more s开发者_JS百科pecific, on a Mac this executable would be the .app file, and on Windows this would be the .exe file.

EDIT2: loaderInfo.url won't work — it gives the name of the SWF file running within the AIR app, not the name of the containing AIR app/exe. If you're on a Mac, you can see this SWF file by opening the package contents of the AIR app, and looking in the Resources folder.


Use the following process:

  • Use the class XSLTProcessor, with HTMLLoader if necessary
  • Create an XSLT stylesheet which applied to the <filename> element
  • Apply it to the application descriptor file
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜