Modify

Opened 15 years ago

Closed 13 years ago

#1953 closed Bug (Rejected)

FileExists returns 1 for non existing path

Reported by: danbu Owned by:
Milestone: Component: AutoIt
Version: 3.3.6.1 Severity: None
Keywords: FileExists Cc: danbu@…

Description

Function FileExists returns 1 instead of 0 for strings consisting of any combination of dots and spaces, which contains at least one dot. For example: ".. ..", " . . ", ". . . . .", "...............................".
If I add a path in the begining it also works: "c:\......", "c:\windows\ ...".

Of course only one and only two dots (".", "..") are correct file names.

Function FileGetTime with the same argument returns an error for all above path except '.' and '..'.

I have used Autoit 3.3.6.1 and beta 3.3.7.9 under Windows XP Pro, Windows Vista Enterprise, Windows Server 2003, all 32-bit. This bug concerns both AutoIt3 and Aut2Exe. I ran this script in several previous version of AutoIt with the same result.

There is a cource code to show this bug.

Dim $file_ok
Dim $file_err
Dim $file_time
Dim $file=''

Dim $array[6]
Dim $num=6
$array[0]='.'
$array[1]='..'
$array[2]='.....'
$array[3]='. . .'
$array[4]='c:\......'
$array[5]='c:\windows\   ...'

for $i=0 to $num-1 step 1
  $file=$array[$i]
  If FileExists($file) Then
    $file_ok = $file_ok & @CRLF & 'name: "' & $file & '", attr: ' & FileGetAttrib ($file) & '", time: '
    $file_time = FileGetTime ($file,0,1)
    if @error=0 then
      $file_ok = $file_ok & $file_time
    Else
      $file_ok = $file_ok & 'ERROR'
    EndIf  
  Else  
    $file_err = $file_err & @CRLF & '"' & $file & '"'
  EndIf
  $file = $file & '.'
next

if $file_ok<>'' Then MsgBox(0,"OK","Files which exist: " & $file_ok)
if $file_err<>'' Then MsgBox(16,"Error","Files which doesn't exist: " & $file_err)

Attachments (0)

Change History (2)

comment:1 by trancexx, 14 years ago

Quick code review indicates that there could be problems with FileGetTime and related functions.
Additional problem seems to be file system redirector.

comment:2 by Jon, 13 years ago

Resolution: Rejected
Status: newclosed

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.