objective c - run install script when installing preference pane -
i've written ruby script looking @ wrapping in preference pane purpose of configuring ruby script. hoping there way me run arbitrary commands when preference pane gets installed in order install necessary ruby gems etc, can't seem find documentation on sort of functionality anywhere.
any ideas appreciated.
cheers nick
you call ruby script performs necessary configurations you. if need install gems, you'll need run elevated privileges. how i've done in past:
// path helper script main app bundle nsbundle *appbundle = [nsbundle mainbundle]; nsstring *scriptpath = [appbundle pathforresource: @"helperscript" oftype: @"rb"]; // construct applescript command run helper script elevated privileges nsstring *scriptcommand = [nsstring stringwithformat: @"do shell script \"ruby '%@'\" administrator privileges", scriptpath]; // execute helper script via applescript, log errors nsapplescript *executerubyscript = [[nsapplescript alloc] initwithsource: scriptcommand]; nsdictionary *error = [[nsdictionary alloc] init]; [executerubyscript executeandreturnerror: &error]; [executerubyscript release];
Comments
Post a Comment