Re: fileExistsAtPath with * to indicate random
Re: fileExistsAtPath with * to indicate random
- Subject: Re: fileExistsAtPath with * to indicate random
- From: Randall Meadows <email@hidden>
- Date: Mon, 10 Mar 2008 10:20:28 -0600
On Mar 10, 2008, at 10:10 AM, Mr. Gecko wrote:
Hello, I'm new to cocoa so any help will be appreciated.
I'm needing my application to find out if ImageMagick is installed.
It is usually installed in the root directory(/) and it has the name
of ImageMagick-6.3.8. I want it to detect it even if the version is
6.3.9. That way if there are any updates with ImageMagick I wont
have to update my program for the new one. The only way I can think
of doing it is with fileExistsAtPath but I can't find out how to
have a random indicator or whatever it is called. I tried BOOL
ImageMagick = [[NSFileManager defaultManager] fileExistsAtPath:@"/
ImageMagick*/" isDirectory:YES];
But it does not seem to know * as a random indicator like PHP and
Terminal does. I can't seem to think of a way to do this so, if any
one can help me figure this out I would be very grateful.
Well, you could brute-force it:
entries = directoryContentsAtPath:@"/";
for (NSString *entry in entries) {
if ([entry hasPrefix:@"ImageMagick"])
return ImageMagickInstalled;
}
return ImageMagickNOTInstalled;
And for what it's worth, my ImageMagick is NOT installed in /; if
you're going to be distributing this, assuming the location of the
installation is not going to work.
_______________________________________________
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