Modify

Opened 3 years ago

Closed 3 years ago

#3836 closed Bug (Fixed)

FileExists with trailing quotation mark

Reported by: therks@… Owned by: Jon
Milestone: 3.3.15.5 Component: AutoIt
Version: 3.3.15.4 Severity: None
Keywords: FileExists Cc:

Description

Mentioned here first:
https://www.autoitscript.com/forum/topic/206186-fileexists-with-trailing-quote/

For some reason FileExists is treating paths that end with a quote mark (or multiple marks) as valid.

; Assuming File.txt exists:
ConsoleWrite(FileExists('File.txt'))   ; Returns 1
ConsoleWrite(FileExists('"File.txt"')) ; Returns 0
ConsoleWrite(FileExists('"File.txt'))  ; Returns 0
ConsoleWrite(FileExists('File.txt"'))  ; Returns 1
ConsoleWrite(FileExists('File.txt""')) ; Returns 1

Attachments (0)

Change History (4)

comment:1 Changed 3 years ago by therks@…

The following functions all behave similarly (ignoring the trailing quotation marks and returning valid results):
FileGetAttrib, FileGetLongName, FileGetShortName, FileGetSize, FileGetTime

FileGetVersion behaves expectedly, returning "0.0.0.0"

ConsoleWrite(FileExists(@AutoItExe & '""""""') & @LF)        ; Returns 1
ConsoleWrite(FileGetLongName(@AutoItExe & '""""""') & @LF)   ; Returns C:\Program Files\AutoIt3\Beta\AutoIt3.exe""""""
ConsoleWrite(FileGetShortName(@AutoItExe & '""""""') & @LF)  ; Returns C:\Program Files\AutoIt3\Beta\AutoIt3.exe""""""
ConsoleWrite(FileGetAttrib(@AutoItExe & '""""""') & @LF)     ; Returns A
ConsoleWrite(FileGetSize(@AutoItExe & '""""""') & @LF)       ; Returns 946784
ConsoleWrite(FileGetTime(@AutoItExe & '""""""', 0, 1) & @LF) ; Returns 20210611084604

ConsoleWrite(FileGetVersion(@AutoItExe & '""""""') & @LF)    ; Returns 0.0.0.0 (correct!)

comment:2 Changed 3 years ago by Jpm

  • Owner set to Jpm
  • Status changed from new to assigned

Fix sent to Jon

comment:3 Changed 3 years ago by anonymous

* ? < > " are wildcards. The results are expected if you consider what " does.

View https://docs.microsoft.com/en-us/archive/blogs/jeremykuhne/wildcards-in-windows

comment:4 Changed 3 years ago by Jon

  • Milestone set to 3.3.15.5
  • Owner changed from Jpm to Jon
  • Resolution set to Fixed
  • Status changed from assigned to closed

Fixed by revision [12628] in version: 3.3.15.5

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 owner will remain Jon.
Author


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

 
Note: See TracTickets for help on using tickets.