I'm a web developer and I've recently switched from Windows to Mac OS X Snow Leppard. While on Windows, I developed an AIR 1.5 app that allowed me to open my hosts file and add/edit/remove hosts using a form then saving the updated hosts file. Before I moved to Mac, I wasn't concerned about file permissions because the app was only for my personal use on a Windows machine with one user account. Now that I'm on Mac, I can't save the edited hosts file because of permissions issues on the host file.
can i create a popup that prompts for the username and password and passes it to the OS somehow to save the host file which is stored in
/private/etc/hosts? I realize this could be a security risk if not done carefully, but the task is very specific; WRITE the changes to disc and CLOSE the file. Surely the AIR File API has a way to do this on Mac (and Linux in general since that is where Mac is based). Right now, I use sudo and vi to make hosts manually but that is clunky and a form is much easier.
Hi, I think that if you run your air app using sudo command you can do this kinda job, or you will have to create a Native Application which can elevate your priveleges and edit your hosts file instead of your air app directly :s