Re: fileExistsAtPath with * to indicate random
Re: fileExistsAtPath with * to indicate random
- Subject: Re: fileExistsAtPath with * to indicate random
- From: "Mr. Gecko" <email@hidden>
- Date: Mon, 10 Mar 2008 14:14:30 -0500
Randall Meadows Helped me and I came up with
NSFileManager *fm = [NSFileManager defaultManager];
int i;
NSArray *folders = [fm directoryContentsAtPath:@"/"];
for (i=0;i<[folders count];i++) {
NSString *folder = [folders objectAtIndex:i];
if ([folder hasPrefix:@"ImageMagick"]) {
ImageMagick = [NSString stringWithFormat:@"/%@/bin/
convert",folder];
if ([fm fileExistsAtPath:ImageMagick]) {
return YES;
}
}
}
ImageMagick = @"";
return NO;
With his example.
On Mar 10, 2008, at 2:10 PM, Thomas Engelmeier wrote:
On 10.03.2008, at 17:10, 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.
Any sensible installation will NOT be there. 3rd party command line
stuff should go to /usr/local/bin, with the variants from fink
defaulting to /sw/bin and from dports to an customizable directory.
Basically, the installed binaries should be in the path, and the
shell should be able to locate it via the 'which' command.
So one solution would be to us NSTask to open an shell and locate
ImageMagick.
Regards,
Tom_E
_______________________________________________
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