Re: Bug in dir() leads to Unicode and win_dir()
- Posted by ags <eu at 531pi.co.nz> Jul 16, 2005
- 507 views
Hi Greg My Bad. It seems win_dir("F:\\DATA\\MUSIC") literally means "give me the directory entry "MUSIC" in F:\DATA I guess the confusion on my part is that the standard Euphoria dir() was giving me F:\DATA\MUSIC\* without me adding a trailing slash to the pathname. This must be the operating system's default behaviour as dir() just calls a machine function, like typing in DOS, "dir F:\data\music" will show the contents of the music folder, not 07/06/2005 12:08 PM <DIR> music 0 File(s) 0 bytes Now when I do win_dir(pathname & "\\") it works, however replacing dir() with win_dir() in walk_dir() doesn't recurse properly. Do you think it's worth trying to find the cause of this and fix it in win_dir() or to implement a new walk_win_dir() ? IMHO, the standard Euphoria (/DOS) behaviour is nice, because if you want the folder attributes for the folder you are looking at you need only examine the '.' entry? Good job on this BTW :) Gary ags wrote: > > Greg Haberek wrote: > > > > While working on my Backup Utility for work, I found a bug in > > Euphoria's dir() routine. It does not support extended ASCII > > characters and just returns a question mark '?' in place of unknown > > characters. > > Hi. While this is great news and probably explain a crash I am having at > work, I have encountered a problem with this, ie: > > }}} <eucode> > junk = win_dir(folname) > > the t_race shows after this line: > folname={70F,58:,92\,100d,97a,116t,97a,92\,109m,117u,115s,105i,99c} > junk={{{109m,117u,115s,105i,99c},{100d},0,105i,7,7,0,8,23}} > <font color="#330033"></eucode> {{{ </font> > > Which is not right, since there is no 'music' subfolder of "F:\data\music". > > I'm running WinXP SP2 and the F: Drive is NTFS. > > Also, while I'm here, when this didn't work I was attempting to add this > to the include file: > > }}} <eucode> > global function walk_win_dir(sequence path_name, integer your_function, > integer scan_subdirs) > object nothing > > my_dir = routine_id("win_dir") -- use win_dir() please > -- my_dir is global atom in file.e > nothing = walk_dir(path_name, your_function, scan_subdirs) > my_dir = -2 -- constant DEFAULT=-2 in file.e > return nothing > end function > <font color="#330033"></eucode> {{{ </font> > > I don't know if this can be incorporated? > > Gary >