[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] Longfilename support functions?



Hi,

On Wed, May 31, 2000 at 12:52:05PM +0200, Stanislav Opichal wrote:
> Hi!
> 
> > You could use Fxattr() (with "follow links" flag on) on the file. If dev
> > and index are identical to an already opened group's file, don't open it
> > again. This will not only work for different cases in filenames on
> > filesystems not regarding case, but also for symbolic links.
> 
> OK, thanks!

Will this work with filesystems like TOS/VFAT (and both on MiNT and Magic)
that don't record a file index?

If you can live without driver letters (i. e. not "c:\\auto\\mint.prg" but
"/c/auto/mint.prg") you can simply use the library function realpath which
will resolve not only soft links but also (the special hard links) "." and
".." in pathname components.  The function gives you a normalized path
name, freed of all that stuff.  You still need to check for a duplicate
file index to detect hard links (i. e. incarnations of the same file under
different names).  File systems that offer hard links always record a file
index and so this is safe.  There is no need to check or remember the
device the file resides on because soft links are already resolved by
realpath() and there are no cross-device hard links.

The manpage for realpath is attached.

> Anyway, is there a way to get the right (including letter case) filename
> from e.g. VFAT drive?

I think VFAT fills in the "real" filename in struct stat/xattr when
calling stat()/Fxattr(), no matter how you called the function.  But I'm
not sure whether this is always true and documented.

Ciao

Guido
-- 
http://www.stud.uni-saarland.de/
Send your spam to president@whitehouse.gov and your replies to
mailto:guido at freemint dot de

Attachment: realpath.3.gz
Description: application/gunzip