Modify

Opened 13 years ago

Closed 11 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 Changed 12 years ago by trancexx

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

comment:2 Changed 11 years ago by Jon

  • Resolution set to Rejected
  • Status changed from new to closed

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.