
#import "NSString+Paths.h"
#import <Foundation/NSArray.h>
#import <Foundation/NSUtilities.h>
#import <Foundation/NSPathUtilities.h>

@implementation NSMutableString (MiscPaths)

//-----------------------------------------------------------------------
// Manipulating paths using all the immutable methods.
//-----------------------------------------------------------------------

// This method donated by Robert Todd Thomas
- (void) abbreviateWithTildeInPath
{
	 [self setString:[self stringByAbbreviatingWithTildeInPath]];
}

// This method donated by Robert Todd Thomas
- (void) appendPathComponent:(NSString*)component
{
	[self setString:[self stringByAppendingPathComponent:component]];
}

// This method donated by Robert Todd Thomas
- (void) appendPathExtension:(NSString*)extension
{
	[self setString:[self stringByAppendingPathExtension:extension]];
}

// This method donated by Robert Todd Thomas
- (void) deleteLastPathComponent
{
	[self setString:[self stringByDeletingLastPathComponent]];
}

// This method donated by Robert Todd Thomas
- (void) deletePathExtension
{
	[self setString:[self stringByDeletingPathExtension]];
}

// This method donated by Robert Todd Thomas
- (void) expandTildeInPath
{
	[self setString:[self stringByExpandingTildeInPath]];
}

// This method donated by Robert Todd Thomas
- (void) resolveSymlinksInPath
{
	[self setString:[self stringByResolvingSymlinksInPath]];
}

// This method donated by Robert Todd Thomas
- (void) standardizePath
{
	[self setString:[self stringByStandardizingPath]];
}

// This method donated by Robert Todd Thomas
- (void) appendPathComponents:(NSArray*)components
{
	NSEnumerator*	componentEnumerator;
	NSString*		component;
	
	componentEnumerator = [components objectEnumerator];
	while ((component = [componentEnumerator nextObject]) != nil) {
		[self appendPathComponent:component];
	}
}

@end
