• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Question about Outline View code in Documentation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Question about Outline View code in Documentation
      • From: James McConnell <email@hidden>
References: 
 >Question about Outline View code in Documentation (From: James McConnell <email@hidden>)

  • Prev by Date: Question about Outline View code in Documentation
  • Next by Date: Re: Question about Outline View code in Documentation
  • Previous by thread: Question about Outline View code in Documentation
  • Next by thread: Re: Question about Outline View code in Documentation
  • Index(es):
    • Date
    • Thread