Re: Question about Outline View code in Documentation
Re: Question about Outline View code in Documentation
- Subject: Re: Question about Outline View code in Documentation
- From: mmalcolm crawford <email@hidden>
- Date: Fri, 6 Feb 2004 19:49:35 -0800
On Feb 6, 2004, at 7:15 PM, James McConnell wrote:
Greetings, all. In /Developer/Examples/AppKit/Outline View, the
project has
a file for FileSystemItem, representing a file system item.
[...]
By default, it is set at "/". I would like this set to
"/Users/myuseraccount/Documents/folder", where "myuseraccount" is the
account this app will be running under
One way (though you're left with the full path displayed at the root --
you could do this more elegantly):
To FileSystemItem.h add:
- (void)setRelativePath:(NSString *)newRelativePath;
To FileSystemItem.m add:
- (void)setRelativePath:(NSString *)newRelativePath {
[relativePath autorelease];
relativePath = [newRelativePath copy];
}
Then replace:
- (id)initWithPath:(NSString *)path parent:(FileSystemItem *)obj {
if (self = [super init]) {
[self setRelativePath:[path lastPathComponent]];
parent = obj;
}
return self;
}
+ (FileSystemItem *)rootItem {
if (rootItem == nil)
{
NSString *rootPath = NSHomeDirectory();
rootItem = [[FileSystemItem alloc] initWithPath:rootPath
parent:nil];
[rootItem setRelativePath:rootPath];
}
return rootItem;
}
mmalc
_______________________________________________
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.