• 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: setFileNameAtPath ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: setFileNameAtPath ?


  • Subject: Re: setFileNameAtPath ?
  • From: Chris Long <email@hidden>
  • Date: Sun, 27 Jul 2003 12:57:07 +0900

Take a look at NSString documents under "working with paths"

stringByDeletingLastPathComponent



On Sunday, July 27, 2003, at 12:47 PM, R. Ecalcitrance wrote:

> Friends,
>
> a guy walks into a bar and says to the bartender:
>
> "I have this code and it's working. but I'd like to change the
> name of
> the file at the end of the path. I've had a good poke round the apple
> site
> and through the ponderous list archive, nothing. seems like it should
> be so
> easy. am I just missing it?"
>
> //
>
> - (IBAction)push:(id)sender
> {
> int result;
>
> NSArray *fileTypes =
> [NSArray arrayWithObjects: @"aif",
> NSFileTypeForHFSTypeCode('AIFF'),
> @"sd2", NSFileTypeForHFSTypeCode('Sd2f'),
> @"txt", NSFileTypeForHFSTypeCode('TEXT'),
> nil];
>
> NSOpenPanel *oPanel = [NSOpenPanel openPanel];
> [oPanel setAllowsMultipleSelection:NO];
>
> NSString *username = NSUserName();
> result = [oPanel
> runModalForDirectory:NSHomeDirectoryForUser(username)
> file:nil types:fileTypes];
>
> if(result == NSOKButton)
> {
> int i = 0;
> NSArray *filesToOpen = [oPanel filenames];
> NSString *aFile_path = [filesToOpen objectAtIndex:i];
> NSString *aFile = [[NSFileManager defaultManager]
> displayNameAtPath:aFile_path];
>
> [textField setStringValue:aFile];
> }
> }
>
> //
>
>
> Akira
>
>
>
>
>
> __chaos_______to_
> oO
> http://AkiraRabelais.com
> _______bliss__oO
>
> chaos
> chaps
> chapt
> coapt
> coast
> hoast
> hoist
> hoise
> noise
> noisy
> noily
> soily
> saily
> sadly
> madly
> sadly
> sally
> selly
> sells
> seals
> sears
> stars
> stays
> slays
> slaps
> slips
> blips
> bliss
> _______________________________________________
> 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.

  • Prev by Date: Re: Possible use of NSKeyedArchive
  • Next by Date: Saving Information from NSTableView (kind of basic)
  • Previous by thread: setFileNameAtPath ?
  • Next by thread: Saving Information from NSTableView (kind of basic)
  • Index(es):
    • Date
    • Thread