delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/01/04:58:52

Date: Wed, 1 Oct 1997 10:57:06 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Cesar Scarpini Rabak <csrabak AT dce03 DOT ipt DOT br>
cc: djgpp AT delorie DOT com
Subject: Re: libc functions handling of UNCs
In-Reply-To: <1.5.4.32.19970930141051.00698bf4@dce03.ipt.br>
Message-ID: <Pine.SUN.3.91.971001105636.10422A-100000@is>
MIME-Version: 1.0

On Tue, 30 Sep 1997, Cesar Scarpini Rabak wrote:

> >Actually, programs that need to use argv[0] to open files, need to be 
> >aware of this problem and translate the UNC into a d:/path name.  It is a 
> >pain in the lower back, but I know of no other solution.  One other 
> >problem with using argv[0] on Windows 95 is that it always gets the 8+3 
> >alias, even if the .exe has a valid long name *and* you invoked the 
> 
> Yes, we noticed this idiosyncrasy as well... but this one did not bite our
> hand,  (one is able to open a file via its alias).

If you only want to open the file, then the short alias is enough.
However, for more sophisticated tasks, such as finding the program's
section in some system-wide configuration file (like DJGPP.ENV, for
example), it won't work, because these usually require an exact match.
You cannot even expect a match in the first 8 characters, because the
NameNumericTail setting can change what the 8+3 alias looks like.
It's a real mess.

> Humm, your observation if correct, may mean that there is hope: if native
> Win32 programs also have this problem, but aplications like Explorer,
> Notepad, etc., are able to show in their file menus the longfilenames, then
> there should be a documented way of doing it!

Of course, there is a way: just call `_truename' on the 8+3 alias, and
you get the long name.  Sounds simple, right?  Well, it isn't: when
`_truename' returns a UNC, you need some extra work to map it back to
the "d:/path" form.  (See the `kpse_set_progname' function on
progname.c in the v2apps/tex/kpse30s.zip distribution, if you are
interested).

PS: when you need to deal with these subtle system-level aspects, you
really begin to understand people who feel disgusted at Microsoft's
work.  A wise person told somewhere that it feels as if somebody at
Microsoft has foreseen all the ways you can devise to work around
their mis-features, and has blocked them all.  (Well, if that's how it
really is, then we are lucky they did a lousy job, since some
work-arounds are still available; but it's surely a mess to take
them.)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019