hartkopf@tramp.Colorado.EDU (Jeff Hartkopf) (12/18/89)
How do I check to see if two path names are the same using GS/OS, but not using ProDOS file system conventions? For example, in a file copy routine, I have the user choose the file to copy from a Standard File get file dialog and the new path name from a put file dialog. Say the new file name is the same as the old, but in a different folder--normally I could just delete the destination file before creating it again, then copying to it. But it's possible that the user will choose the identical pathname as the destination file, except, say, with different capitalization in the file name. In this case I couldn't delete the file, because then there would be nothing to copy from! So what I need is some way to tell if I should delete the destination file: if it's in the same directory, with the same file name (according to the current file system) no, but otherwise yes. And I can't convert the path names to upper case and compare them, because that's ProDOS convention--I want it to work with any file system. If anyone has any ideas, or has a different way to handle copying a file onto the same file name, please let me know! Thanks. Jeff Hartkopf Internet: hartkopf@tramp.Colorado.EDU
dlyons@Apple.COM (David A. Lyons) (12/21/89)
In article <14966@boulder.Colorado.EDU> hartkopf@tramp.Colorado.EDU (Jeff Hartkopf) writes: >How do I check to see if two path names are the same using GS/OS, but >not using ProDOS file system conventions? >[...] >If anyone has any ideas, or has a different way to handle copying a file >onto the same file name, please let me know! Thanks. > >Jeff Hartkopf Hmmm...this is a slightly wimpy answer, but here's an alternate approach. Just OPEN the source file before you try to open or destroy the destination file. If the files are the same then the Destroy or Open (for Write permission) will fail. This won't help you know when to display a very specific message about not being able to replace a file with itself, but you could display something more generic ('The file Blah is in use and can't be replaced' or whatever). -- --David A. Lyons, Apple Computer, Inc. | DAL Systems Apple II Developer Technical Support | P.O. Box 875 America Online: Dave Lyons | Cupertino, CA 95015-0875 GEnie: D.LYONS2 or DAVE.LYONS CompuServe: 72177,3233 Internet/BITNET: dlyons@apple.com UUCP: ...!ames!apple!dlyons My opinions are my own, not Apple's.