Write file permission and terminal command parameter invoke on mac (firemonkey delphi)


i wrote simple apps to edit hosts file… but it requires elevation which i do not know how to implement elevation in mac whenever user click the button

procedure TForm1.Button3Click(Sender: TObject);
var MyFile : TextFile;
FileD : TStringList;
FileL : string;
if not memo1.Text.IsEmpty then
FileL := ‘/etc/hosts’;
FileD := Tstringlist.create();
FileD.Text := memo1.Text;
Filed.SaveToFile(FileL); // Required elevation

i want to interact with mac shell within my firemonkey apps..
in example

sudo mv /users/name/documents/temphosts /etc/hosts

so i could overwrite the hosts file after asking user permission.

Comments are closed.