Re: Comparing apples & oranges (well, Strings & mount points)
Re: Comparing apples & oranges (well, Strings & mount points)
- Subject: Re: Comparing apples & oranges (well, Strings & mount points)
- From: Brian Ganninger <email@hidden>
- Date: Sat, 15 Feb 2003 19:31:59 -0600
Thanks to those who have responded or emailed me. A few more clarifications
are in order about the problem.
1. According to Cocoa documentation itself the mountedLocalVolumes method
inside NSWorkspace returns an array of mount points, not strings. Thus, if
you try to create a string using initWithString:[array objectAtIndex:x] the
following error occurs:
*** -[NSCFString objectAtIndex:]: selector not recognized
2. (NSString *) will not work either, and all the class & instance methods
for init or stringWithX do not work when sent objectAtIndex (see 1).
3. Using string = [array description]; will result in a property list
containing the strings of the mount points (visible by passing this string
to NSLog), but the question is how to get at them inside of said property
list (as trying the componentsBySubstring:", " method (which returns an
array of strings) on the description string doesn't work)
So another way to ask the question is: what type of object is a mount point
and how can I convert it from said mount point to a string.
- Brian Ganninger
On 2/15/03 2:42 PM, "Jean-Daniel Dupas" <email@hidden> wrote:
>
Hello i don't really understand your question but i will try to help you.
>
You're syaing that the array contains mountPoint, but mount point are
>
string so you can use it with the NSFileManager to try if the path exist, or
>
use isEqualToString if you want. More generaly, NSObject as an isEquals
>
methode so if your object is a subCalss of objecj (all class except NSProxy)
>
you can use isEqual to compare.
>
After to change the icon, you need add a ".VolumeIcon.icns " file in the
>
root of the volme, so in the mountPath return in the array.
>
But just now that a mogunt point is a path (NSString)
>
"- (NSArray *) mountedRemovableMedia
>
>
Returns an NSArray of NSStrings containing the full pathnames of all
>
currently mounted removable disks. "
>
> Message: 11
>
> Date: Sat, 15 Feb 2003 01:31:28 -0600
>
> From: Brian Ganninger <email@hidden>
>
> Subject: Comparing apples & oranges (well, Strings & mount points)
>
> To: email@hidden
>
>
>
> I'm new to the list so please be gentle. I've searched the archives and the
>
> documentation (and as much source code as possible) but I can't seem to find
>
> a clean way to determine what I need.
>
>
>
> Here's the situation:
>
> I'm trying to get a list of mounted volumes (using NSWorkspace), and to then
>
> take the returned array and use those individually ([array objectAtIndex:x])
>
> to compare to a string to see if they are equal (in essence, verifying a
>
> location is a mounted volume and simply not a junk string or path). Since
>
> the returned array contains mount points instead of strings, I have no idea
>
> how to re-format the array's contents to allow for comparison.
>
>
>
> The ancillary question is, once compared, how can I take either string and
>
> then convert it into a true path for then getting (and setting) the volume's
>
> icon.
>
>
>
> Thanks to any all who can provide insight and help, I've nearly broken a
>
> hole in my wall banging my head against it.
>
>
>
> - Brian Ganninger
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.