Skip to main content
Participant
March 22, 2012
Answered

HTML/JS app doesn't work unless Run as Administrator

  • March 22, 2012
  • 1 reply
  • 1044 views

I've created an Air app (air 3.1) with JS/HTML and I'm compiling on Windows 7 64bit, using the Air SDK 3.1. Self-signed cert.

It seems if I run the air app without selecting "Run as administrator", it loads the initial window but no further events seem to be captured - mouse clicks within the app don't do anything for example and its clear from the Windows Task Manager that none of the cpu/mem resources I'd expect it to be using are.

If I run it as administrator everything is hunky dory.

Obviously I don't want to have to instruct windows users to Run As Administrator, so how do I get this to work by default without the admin privilege. Is it something to do with the lack of proper cert?

This topic has been closed for replies.
Correct answer chris.campbell

xcession2000 wrote:

... which i'm writing to air.File.applicationDirectory.

I believe this is the problem.  On Windows Vista forward, the application directory (typically program files) requires elevated permissions for writing.  Instead of using File.applicationDirectory, try File.applicationStorageDirectory.

http://blogs.adobe.com/simplicity/2008/06/dont_write_to_app_dir.html

Chris

1 reply

chris.campbell
Legend
March 23, 2012

Can you try running under ADL to see if you're throwing an exception?  Could you be writing files to a location that requires elevated privileges?

Chris

Participant
March 23, 2012

Nothing in ADL suggests any errors - it doesn't output anything unexpected. The app is incredibly simple and only relies on the database file, which i'm writing to air.File.applicationDirectory.

If i comment out all the javascript so its literally just a single html file, it still requires admin to work correctly.

chris.campbell
chris.campbellCorrect answer
Legend
March 23, 2012

xcession2000 wrote:

... which i'm writing to air.File.applicationDirectory.

I believe this is the problem.  On Windows Vista forward, the application directory (typically program files) requires elevated permissions for writing.  Instead of using File.applicationDirectory, try File.applicationStorageDirectory.

http://blogs.adobe.com/simplicity/2008/06/dont_write_to_app_dir.html

Chris