RE: Removing folder from /Applications
RE: Removing folder from /Applications
- Subject: RE: Removing folder from /Applications
- From: "Glover,David" <email@hidden>
- Date: Tue, 8 Jul 2008 13:20:58 +0100
- Thread-topic: Removing folder from /Applications
Hi, here is the code;
[...]
// create the authorization reference...
AuthorizationRef myAuthorizationRef;
OSStatus myStatus;
myStatus = AuthorizationCreate (NULL,
kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults,
&myAuthorizationRef);
// if the folder isn't there, then don't try to remove it!
if ([NSFm fileExistsAtPath:@"/Applications/Folder" isDirectory:
&isDir] && isDir)
{
// set up authorization before attempting to remove the
folder...
AuthorizationItem myItems[1];
myItems[0].name =
"com.promethean.DeviceRegisterUninstaller";
myItems[0].valueLength = 0;
myItems[0].value = NULL;
myItems[0].flags = 0;
AuthorizationRights myRights;
myRights.count = sizeof (myItems) / sizeof (myItems[0]);
myRights.items = myItems;
AuthorizationFlags myFlags;
myFlags = kAuthorizationFlagDefaults |
kAuthorizationFlagInteractionAllowed |
kAuthorizationFlagExtendRights;
myStatus = AuthorizationCopyRights (myAuthorizationRef,
&myRights, kAuthorizationEmptyEnvironment, myFlags, NULL);
if ([NSFm removeFileAtPath: (NSString *)
@"/Applications/Folder" handler: nil] == NO)
{
[...]
-----Original Message-----
From: cocoa-dev-bounces+david.glover=email@hidden
[mailto:cocoa-dev-bounces+david.glover=email@hidden.c
om] On Behalf Of Robert Cerny
Sent: 08 July 2008 12:35
To: Cocoa Development
Subject: Re: Removing folder from /Applications
On 8.7.2008, at 12:52, Glover,David wrote:
> Hi there,
>
>
>
> I've create a little app that is required to remove an obsolete folder
> from /Applications. This works fine when the user is logged in as an
> Admin, but not when logged in as a Standard user, as they obviously
> require authorization.
>
>
>
> So, I added some code to request an Admin username and password using
> Authorization Services, immediately before calling removeFileAtPath to
> remove the folder. However, the folder still cannot be removed after
> inputting an Admin username and password.
>
>
>
> Please can anybody offer any insight into what I'm missing here?
>
>
>
> Kind regards
>
>
>
> Dave
Hi Dave,
hard to help without any code.
Robert
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
anworld.com
This email sent to email@hidden
Promethean Limited is a company registered in England and Wales with company number 1308938 and VAT number GB 572 2599 18
______________________________________________
Promethean Ltd and or associated and or subsidiary companies :
The views expressed in this communication may not necessarily be
the views held by Promethean Ltd and or associated and or subsidiary companies.
This e-mail is for the exclusive use of the addressee(s). Unauthorised
disclosure, copying or distribution is prohibited.
This e-mail message has been swept for the presence of computer viruses.
Promethean Ltd and or associated and or subsidiary companies accepts no liability for any loss resulting from this email transmission.
Promethean, Promethean House, Lower Philips Road, Blackburn, Lancashire, BB1 5TH, UK. Please update your records accordingly. Thank you!
*****************************************************************
This email has been checked by the e-Sweeper Service
*****************************************************************
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden