Text file types
Text file types
- Subject: Text file types
- From: Angela Brett <email@hidden>
- Date: Thu, 6 Feb 2003 01:12:12 +1300
Hello,
I had to replace some text in a few files and couldn't be bothered
doing it manually, so I slapped together a little tool to replace
text in all files in a directory. It works fine, but has raised a few
questions. They're not really important to my tool as it was never
meant to be very polished, but I'd be interested in the answers
anyway.
I realised too late that it was going through every single file in
the directory, including images and other binary files. Of course
those files did not have the markers in them to replace the text
between, so they were written straight back out again as they were.
They don't seem to be any the worse from being loaded into an
NSString and back out again... that's one thing I'm curious about -
is there any chance that loading a binary file into an NSString and
writing it straight back out again would break it?
My other question is, is there a method (perhaps something like
NSImage's - imageFileTypes) which I can use to determine whether a
file is likely to be some sort of text file? I don't mean just
checking for files with the .txt or .text extensions, I want to
include other text files such as html and C.
--
Play Brettrix and make the world's only kiwiloon happy!
http://cocoa.co.nz/brettrix.html
_______________________________________________
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.