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

Re: Renaming files?


  • Subject: Re: Renaming files?
  • From: Christoffer Lerno <email@hidden>
  • Date: Wed, 22 Dec 2004 10:56:08 +0100

On Dec 20, 2004, at 23:11, Jeremy Dronfield wrote:

If you're having trouble with spaces, I think there's something going wrong with the way you're feeding pathnames to NSFileManager. I just tried it with files called:

“!”•¶ ^^ é @£##   {€} %\<> .gif
©∆    Ø∏  ‡   ‰üœÚ  ¬ ƒ©    ≠ª  .tiff

which I renamed as

new0001.gif
new0002.tiff

using -[NSFileManager movePath:toPath:handler:] No problem. To test it back the other way, I renamed "new0002.tiff" as "U î Ü © #€ {˚}0002.tiff". Again no problem.

You're right (as I said to Clark Cox) it turns out that the encoding is different in the filenames when I get them back. Try taking new00002.tiff, name it
“!”•¶ ^^ é @£## {€} %\<> .gif by using movePath:toPath:handler: and then compare the NSString you kept the new filename in with the filenames gotten from - (NSArray *)directoryContentsAtPath:(NSString *)path


It would seem that they have different encodings the filenames won't match unless I use compare (isEqualToString doesn't work)

I wonder if there is some way to take my NSString from the NSTextField and convert that to the filesystem-encoding so they match up with isEqualToString?

Basically the problem is that in one place I keep track of all the files in a folder, and using kqueue I monitor these changes. When a change occurs I check the folder for updates by comparing my register with that of the directory. However, if I want to rename something, I first update the filename in the register, then run the rename. When kqueue signals a change, the register will think no changes have been made (ideally). However, since the filename I update with doesn't match the filename I get with directoryContentsAtPath, the register will think I added one file and removed another, which turns out to be a problem in the context of my app.

Basically I want to know what the heck my file is called after it's renamed... :) It isn't exactly what I renamed it to, even though it prints and looks the same.


/C _______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Renaming files?
      • From: Clark Cox <email@hidden>
    • Re: Renaming files?
      • From: Jeremy Dronfield <email@hidden>
References: 
 >Renaming files? (From: Christoffer Lerno <email@hidden>)
 >Re: Renaming files? (From: Jeremy Dronfield <email@hidden>)

  • Prev by Date: Re: Examining the Call Stack
  • Next by Date: Re: Renaming files?
  • Previous by thread: Re: Renaming files?
  • Next by thread: Re: Renaming files?
  • Index(es):
    • Date
    • Thread