Обсуждение: Tilde expansion on Win32
I noticed that we don't expand tildes in Win32 because of the use of
tilde in short versions of long file names:
char *expand_tilde(char **filename){ if (!filename || !(*filename)) return NULL; /* MSDOS uses tilde for
shortversions of long file names, so skip it. */#ifndef WIN32 /* try tilde expansion */ if (**filename == '~')
{
However, I thought the tilde was usually used toward the end of the file
name, not at the beginning. Is this true? Should this code be modified?
-- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610)
359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square,
Pennsylvania19073
Bruce Momjian wrote:
> I noticed that we don't expand tildes in Win32 because of the use of
> tilde in short versions of long file names:
>
> char *
> expand_tilde(char **filename)
> {
> if (!filename || !(*filename))
> return NULL;
>
> /* MSDOS uses tilde for short versions of long file names, so skip it. */
> #ifndef WIN32
>
> /* try tilde expansion */
> if (**filename == '~')
> {
>
> However, I thought the tilde was usually used toward the end of the file
> name, not at the beginning. Is this true? Should this code be modified?
>
If you talking about WIn32 ~ they are typically in the middle. Like:
program files === progra~1
Sincerely,
Joshua D. Drake
--
Your PostgreSQL solutions provider, Command Prompt, Inc.
24x7 support - 1.800.492.2240, programming, and consulting
Home of PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit
http://www.commandprompt.com / http://www.postgresql.org
> -----Original Message-----
> From: pgsql-hackers-owner@postgresql.org
> [mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Bruce Momjian
> Sent: 10 June 2005 15:31
> To: PostgreSQL-development
> Subject: [HACKERS] Tilde expansion on Win32
>
> I noticed that we don't expand tildes in Win32 because of the use of
> tilde in short versions of long file names:
>
> char *
> expand_tilde(char **filename)
> {
> if (!filename || !(*filename))
> return NULL;
>
> /* MSDOS uses tilde for short versions of long file
> names, so skip it. */
> #ifndef WIN32
>
> /* try tilde expansion */
> if (**filename == '~')
> {
>
> However, I thought the tilde was usually used toward the end
> of the file
> name, not at the beginning. Is this true? Should this code
> be modified?
Yes, it's true - long filenames may be shortened to something like
Long filename.document -> longfi~1.doc
To munge them into 8.3 format. Without looking at the code I assume that
it is expanding ~dpage into /home/dpage or whatever? If so, I'd be
inclined to leave it - tilde isn't used like that on Windows.
Regards, Dave
Dave Page wrote:
>
>
> > -----Original Message-----
> > From: pgsql-hackers-owner@postgresql.org
> > [mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Bruce Momjian
> > Sent: 10 June 2005 15:31
> > To: PostgreSQL-development
> > Subject: [HACKERS] Tilde expansion on Win32
> >
> > I noticed that we don't expand tildes in Win32 because of the use of
> > tilde in short versions of long file names:
> >
> > char *
> > expand_tilde(char **filename)
> > {
> > if (!filename || !(*filename))
> > return NULL;
> >
> > /* MSDOS uses tilde for short versions of long file
> > names, so skip it. */
> > #ifndef WIN32
> >
> > /* try tilde expansion */
> > if (**filename == '~')
> > {
> >
> > However, I thought the tilde was usually used toward the end
> > of the file
> > name, not at the beginning. Is this true? Should this code
> > be modified?
>
> Yes, it's true - long filenames may be shortened to something like
>
> Long filename.document -> longfi~1.doc
>
> To munge them into 8.3 format. Without looking at the code I assume that
> it is expanding ~dpage into /home/dpage or whatever? If so, I'd be
> inclined to leave it - tilde isn't used like that on Windows.
OK, you d'man. I will leave it.
I know we can't support ~user/ on Win32, but I thought maybe we should
support ~/.
-- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610)
359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square,
Pennsylvania19073