BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

File extension bug in D7? or Windoze?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.misc
View previous topic :: View next topic  
Author Message
Steven
Guest





PostPosted: Fri Nov 14, 2003 7:34 pm    Post subject: File extension bug in D7? or Windoze? Reply with quote



Under D7 I'm using the FindFirst / FindNext functions to find my local HTML
files, for which I use the mask "*.htm". Now I also get files with the
extension ".html".
Is this a bug in D7? Or in Windoze? (like extensions always truncated to
three characters)


Back to top
Maarten Wiltink
Guest





PostPosted: Fri Nov 14, 2003 7:38 pm    Post subject: Re: File extension bug in D7? or Windoze? Reply with quote



"Steven" <stevenPANTSvh (AT) pandora (DOT) be> wrote


Quote:
Under D7 I'm using the FindFirst / FindNext functions to find my
local HTML files, for which I use the mask "*.htm". Now I also get
files with the extension ".html". Is this a bug in D7? Or in Windoze?
(like extensions always truncated to three characters)

Perhaps the short file names which have been assigned to these
..html files really do end in .htm, and FindFirst/Next is finding
them. I would consider that a bug, yes.

Groetjes,
Maarten Wiltink



Back to top
Rob Kennedy
Guest





PostPosted: Fri Nov 14, 2003 8:36 pm    Post subject: Re: File extension bug in D7? or Windoze? Reply with quote



Maarten Wiltink wrote:
Quote:
Perhaps the short file names which have been assigned to these
..html files really do end in .htm, and FindFirst/Next is finding
them. I would consider that a bug, yes.

Extensions of long files names are indeed truncated to three characters.
I don't really consider it a bug, though. The short file name is just as
valid as the long one, so how is FindFirst supposed to know which you
want? The TWin32FindData record returned contains both names. I think
the short extension of a file such as "index.html.bak" will be htm, not bak.

The filtering abilities of FindFirst are so limited already that I don't
think the added task of confirming a three-character file-name extension
makes much of a difference. You could use the PathMatchSpec API function
to compare the returned name against the desired mask.

--
Rob


Back to top
Sven Pran
Guest





PostPosted: Fri Nov 14, 2003 11:51 pm    Post subject: Re: File extension bug in D7? or Windoze? Reply with quote

"Steven" <stevenPANTSvh (AT) pandora (DOT) be> wrote

Quote:
Under D7 I'm using the FindFirst / FindNext functions to find my local
HTML
files, for which I use the mask "*.htm". Now I also get files with the
extension ".html".
Is this a bug in D7? Or in Windoze? (like extensions always truncated to
three characters)

I am too lazy (tired) to investigate the effect, but have you tried to use
a six character mask: "*.htm " (with a space added after htm)?

regards Sven



Back to top
Jud McCranie
Guest





PostPosted: Sat Nov 15, 2003 12:04 am    Post subject: Re: File extension bug in D7? or Windoze? Reply with quote

On Fri, 14 Nov 2003 19:34:54 GMT, "Steven" <stevenPANTSvh (AT) pandora (DOT) be>
wrote:

Quote:
Under D7 I'm using the FindFirst / FindNext functions to find my local HTML
files, for which I use the mask "*.htm". Now I also get files with the
extension ".html".
Is this a bug in D7? Or in Windoze? (like extensions always truncated to
three characters)

I encountered this too, and I did a little digging and found out what
is going on. First, note that if you d a DIR with that file
specification at a DOS prompt in modern versions of Windows, it will
also list the *.html files. That indicates that it is something in
Windows. After asking around, the answer is pretty simple (although I
don't like it).

With a long file name, Windows also stores an 8.3 file name, and
*.html gets a .htm extension. FindFirst and FindNext get files whose
long OR short file name matches the mask (because that's what the DOS
emulator in Windows does). So that is why it gets .html files - the
short file name matches the mask.




Back to top
Duncan Murdoch
Guest





PostPosted: Sat Nov 15, 2003 12:27 pm    Post subject: Re: File extension bug in D7? or Windoze? Reply with quote

On Fri, 14 Nov 2003 14:36:18 -0600, Rob Kennedy <.> wrote:

Quote:
Extensions of long files names are indeed truncated to three characters.

.... in the short filename version. They are also available at full
length, so *.html will find html files, but not htmm files.

Quote:
I don't really consider it a bug, though. The short file name is just as
valid as the long one, so how is FindFirst supposed to know which you
want? The TWin32FindData record returned contains both names. I think
the short extension of a file such as "index.html.bak" will be htm, not bak.

No, it's bak. The rule is: the 8 letter start of the short name is
based on the name up to the first dot, the 3 letter extension is the
first 3 letters following the last dot. You can't easily predict
exact what the 8 letter part will be, unless you know what other 8
letter parts are already there in the directory: each 8.3 name must
be unique.

Duncan Murdoch

Back to top
Dr John Stockton
Guest





PostPosted: Sat Nov 15, 2003 1:08 pm    Post subject: Re: File extension bug in D7? or Windoze? Reply with quote

JRS: In article <vraf5ro8t9c379 (AT) corp (DOT) supernews.com>, seen in news:comp.
lang.pascal.delphi.misc, Rob Kennedy <?.?@?.?> posted at Fri, 14 Nov
2003 14:36:18 :-

Quote:
I think
the short extension of a file such as "index.html.bak" will be htm, not bak.

Easily tested : it isn't. It is, for me in Win98, bak.

That is why one should be careful about attachments named as

"picture.jpg .exe"

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Delphi 3 Turnpike 4 ©
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/&c., FAQqy topics & links;
<URL:http://www.bancoems.com/CompLangPascalDelphiMisc-MiniFAQ.htm> clpdmFAQ;
<URL:http://www.borland.com/newsgroups/guide.html> news:borland.* Guidelines

Back to top
Rob Kennedy
Guest





PostPosted: Sat Nov 15, 2003 7:14 pm    Post subject: Re: File extension bug in D7? or Windoze? Reply with quote

Dr John Stockton wrote:
Quote:
Easily tested

Not easily tested. My system does not generate short file names for any
newly created files.

Quote:
: it isn't. It is, for me in Win98, bak.

Thank you.

--
Rob


Back to top
Steven
Guest





PostPosted: Sat Nov 15, 2003 8:40 pm    Post subject: Re: File extension bug in D7? or Windoze? Reply with quote

"Duncan Murdoch" <dmurdoch (AT) pair (DOT) com> schreef in bericht
news:dn6crvgaqpr7hu1km1nobqd7kr4t7q47gb (AT) 4ax (DOT) com...
Quote:
On Fri, 14 Nov 2003 14:36:18 -0600, Rob Kennedy <.> wrote:

Extensions of long files names are indeed truncated to three characters.

... in the short filename version. They are also available at full
length, so *.html will find html files, but not htmm files.


Which means it is a bug. A Windows bug, and not a Delphi bug, if I read
Sysutils.pas and Windows.pas correctly.

*.htm should find index.htm, but not index.html
*.htm* should find both
*.html should only find index.html

Well, we're not gonna blame MS. After all, you can't expect a company of
marketeers and lawyers to know anything about software development. (sorry
Anders)

Thanks for the replies (very quick one from Maarten, but then the cable to
his place is shorter :-)

Steven



Back to top
Duncan Murdoch
Guest





PostPosted: Sat Nov 15, 2003 9:59 pm    Post subject: Re: File extension bug in D7? or Windoze? Reply with quote

On Sat, 15 Nov 2003 20:40:09 GMT, "Steven" <stevenPANTSvh (AT) pandora (DOT) be>
wrote:

Quote:
"Duncan Murdoch" <dmurdoch (AT) pair (DOT) com> schreef in bericht
news:dn6crvgaqpr7hu1km1nobqd7kr4t7q47gb (AT) 4ax (DOT) com...
On Fri, 14 Nov 2003 14:36:18 -0600, Rob Kennedy <.> wrote:

Extensions of long files names are indeed truncated to three characters.

... in the short filename version. They are also available at full
length, so *.html will find html files, but not htmm files.


Which means it is a bug. A Windows bug, and not a Delphi bug, if I read
Sysutils.pas and Windows.pas correctly.

Not a bug, a feature Wink.

Quote:
*.htm should find index.htm, but not index.html

No, because index.html has a number of aliases, including (probably)
index~1.htm. That's the one *.htm finds.

Quote:
*.htm* should find both
*.html should only find index.html

Those both work just the way you want them to.

Duncan Murdoch

Back to top
Kent Briggs
Guest





PostPosted: Sun Nov 16, 2003 2:26 am    Post subject: Re: File extension bug in D7? or Windoze? Reply with quote

Rob Kennedy wrote:

Quote:
Not easily tested. My system does not generate short file names for any
newly created files.

It certainly does if it's on a FAT32 or NTFS volume.


--
Kent Briggs, [email]kbriggs (AT) spamcop (DOT) net[/email]
Briggs Softworks, http://www.briggsoft.com


Back to top
Nicholas Sherlock
Guest





PostPosted: Sun Nov 16, 2003 4:05 am    Post subject: Re: File extension bug in D7? or Windoze? Reply with quote

Kent Briggs wrote:
Quote:
Rob Kennedy wrote:

Not easily tested. My system does not generate short file names for
any newly created files.

It certainly does if it's on a FAT32 or NTFS volume.

While that may be the case for FAT32, you can disable creation of short
files names on NTFS.

Cheers,
Nicholas Sherlock



Back to top
Rob Kennedy
Guest





PostPosted: Sun Nov 16, 2003 4:39 am    Post subject: Re: File extension bug in D7? or Windoze? Reply with quote

Kent Briggs wrote:
Quote:
Rob Kennedy wrote:
Not easily tested. My system does not generate short file names for
any newly created files.

It certainly does if it's on a FAT32 or NTFS volume.

It is an NTFS drive. It certainly does not generate short file names.

--
Rob


Back to top
Jud McCranie
Guest





PostPosted: Sun Nov 16, 2003 5:56 am    Post subject: Re: File extension bug in D7? or Windoze? Reply with quote

On Sat, 15 Nov 2003 22:39:24 -0600, Rob Kennedy <.> wrote:
Quote:
It certainly does if it's on a FAT32 or NTFS volume.

It is an NTFS drive. It certainly does not generate short file names.

I have an NTFS drive and if I use my Turbo Pascal programs, a
SearchRec.name returns a short file name (8.3).


Back to top
Duncan Murdoch
Guest





PostPosted: Sun Nov 16, 2003 10:53 am    Post subject: Re: File extension bug in D7? or Windoze? Reply with quote

On Sat, 15 Nov 2003 22:39:24 -0600, Rob Kennedy <.> wrote:

Quote:
Kent Briggs wrote:
Rob Kennedy wrote:
Not easily tested. My system does not generate short file names for
any newly created files.

It certainly does if it's on a FAT32 or NTFS volume.

It is an NTFS drive. It certainly does not generate short file names.

In that case, what is returned in the cAlternateFileName field of the
WIN32_FIND_DATA structure returned by a call to FindFirstFile? It's
documented as holding an 8.3 filename in cases where the real filename
is not in that form.

Duncan Murdoch

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.misc All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.