Dir[] on Windows w/ long filenames 
Author Message
 Dir[] on Windows w/ long filenames

Ruby 1.6.6

Dir[] doesn't appear to work if any directories have a space in their name:

irb(main):005:0> Dir['c:/temp/*.*']
["c:/temp/10175.094.out", "c:/temp/attach1_snelling.kmap.err[1].zip",
"c:/temp/i
xp001.tmp", "c:/temp/JET1.tmp", "c:/temp/JET2.tmp", "c:/temp/JET3.tmp",
"c:/temp
/JET4.tmp", "c:/temp/JET5.tmp", "c:/temp/JET6.tmp", "c:/temp/JET7.tmp",
"c:/temp
/JET8.tmp", "c:/temp/JETE.tmp", "c:/temp/JETF.tmp", "c:/temp/redist.log",
"c:/te
mp/setupsql.ini", "c:/temp/testunit-0.1.4[1].zip", "c:/temp/_ISTMP1.DIR"]

irb(main):010:0> Dir['c:/program files/UltraEdit/*.*']
[]

irb(main):009:0> Dir.entries('c:/program files/UltraEdit')
[".", "..", "aanew.txt", "AUTOCORR.TLX", "Chrismo.mac", "CONDCORR.TLX",
"Edit2",
 "FILE_ID.DIZ", "html.mac", "Html.tlx", "htmltidy.dll", "INSTALL.LOG",
"ORDER.TX
T", "READ.ME", "SSCE4332.DLL", "TAGLIST.NEW", "TAGLIST.OLD", "TAGLIST.TXT",
"tha
ng.txt", "UE32CTMN.DL", "ue32ctmn.dll", "UEDIFF.EXE", "UEDIT32.EXE",
"UEDIT32.GI
D", "UEDIT32.HLP", "UEDIT32.REG", "uedit32i.exe", "UEDOS32.EXE",
"UNINSTAL.EXE",
 "vbs.mac", "Wordfile.bak.txt", "WORDFILE.NEW", "WORDFILE.OLD",
"Wordfile.txt",
"WORDFILE2.TXT"]

Is this a bug?

Chris Morris



Sat, 18 Sep 2004 05:40:17 GMT  
 Dir[] on Windows w/ long filenames

Quote:

> Ruby 1.6.6

> Dir[] doesn't appear to work if any directories have a space in their
> name:

[snip]

I fired up my newsreader to post almost exactly the same bug; or something
similar.  I'd been testing a Ruby-based game on Win98 which uses Tk for
part of its front-end.  I got an exception thrown when it was stored in
c:\Windows\Desktop\trivia game but seemed fine when run from c:\trivia-swp
-- this was trying to find tcltklib.dll.  The text of the exception claimed
that it had looked in a particular directory where the DLL actually was.  
It ran fine from either location on a Windows 2000 machine.  Hang on, I'll
try again now and be a bit more specific...

--
Matthew



Sat, 18 Sep 2004 07:29:30 GMT  
 Dir[] on Windows w/ long filenames
Hi,

At Tue, 2 Apr 2002 06:20:31 +0900,

Quote:

> Ruby 1.6.6

> Dir[] doesn't appear to work if any directories have a space in their name:

A space is a separator of globbing patterns in 1.6 or former.

$ touch a b 'a b'
$ ls -l
total 0
-rw-r--r--    1 nobu     nakada          0 Apr  2 08:43 a
-rw-r--r--    1 nobu     nakada          0 Apr  2 08:43 a b
-rw-r--r--    1 nobu     nakada          0 Apr  2 08:43 b
$ ruby14-linux -ve 'p Dir["a b"]'
ruby 1.4.6 (2000-08-16) [i686-linux]
["a", "b"]
$ ruby16-linux -ve 'p Dir["a b"]'
ruby 1.6.7 (2002-04-01) [i686-linux]
["a", "b"]
$ ruby17-linux -ve 'p Dir["a b"]'

The behavior has been changed in 1.7.

ruby 1.7.2 (2002-04-01) [i686-linux]
["a b"]

--
Nobu Nakada



Sat, 18 Sep 2004 07:52:21 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. long-to-short dir/filenames

2. Long Filenames okay for physical filenames???

3. DOS 8.3 filenames (how to remove long filenames header)

4. Library os.path.isfile(filename) - long filenames error.

5. Clipper with long filenames under Windows NT

6. Windows 95 long filename format

7. Windows passes filename in 8.3 format and not in long format to tcl script

8. Osx long filenames truncated

9. VW2.0 under Win 95 + long filenames?

10. Long Filenames

11. Spaces in Directory Names - Long Filenames

12. Long Filenames in Clarion

 

 
Powered by phpBB® Forum Software