I need the name of the current logged in user in my Air/Flex application. The application will only be deployed on Windows machines. I think I could attain this by regexing the User directory, but am open to other ways.
相关问题
- Displaying two fullscreen windows on two monitors
- Can I embed a sqlite database in an Air applicatio
- Get list of running processes, get active process
- Flash Logging API
- Adobe AIR mobile app fails when using HTTPS on Nex
相关文章
- Flash CS4 + SQLITE
- AIR - Resizing Native Window Proportionately
- Building an android library project with jar depen
- is there a way to access bluetooth on android via
- TouchEvent.TOUCH_BEGIN, onTouchBegin Freezes after
- Pause and resume download in flex?
- Does Flash Builder 4 now use AIR 2?
- AS3 Working With Arbitrarily Large Files
Update way later: there's actually a built in function to get the current user. I think it's in nativeApplication.
Also I would try:
But I don't have Air installed so I can't really test this...
This isn't the prettiest approach, but if you know your AIR app will only be run in a Windows environment it works well enough:
There's a couple of small cleanups you can make...
As Kevin suggested, use
File.separator
to make the directory splitting cross-platform (just tested on Windows and Mac OS X).You don't need to use
resolvePath("")
unless you're looking for a child.Also, making the function a proper getter allows binding without any further work.
In the above example I put it into a
UserUtil
class, now I can bind toUserUtil.currentOSUser
, e.g:Here is a solution that works in XP / Vista, but is definitely expandable to OSX, linux, I'd still be interested in another way.