PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: CFindFile  (Read 312 times)

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 8937
  • Windows 10
    • PlanetSquires Software
CFindFile
« on: September 24, 2019, 09:34:24 PM »

Hi Jose,

From an email that I received....

"In the CFindFile class, the IsDots function flagged a file named .1%.jpg
Probably a bad idea to have a file beginning with a dot, so I renamed it.
Nevertheless, the IsDots function should not have returned true."
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Josť Roca

  • Moderator
  • Guru Member
  • *****
  • Posts: 3217
Re: CFindFile
« Reply #1 on: September 24, 2019, 10:43:05 PM »

Thanks. Code changed to:

Code: [Select]
PRIVATE FUNCTION CFindFile.IsDots () AS BOOLEAN
   IF (m_FileInfo.dwFileAttributes AND FILE_ATTRIBUTE_DIRECTORY) = FILE_ATTRIBUTE_DIRECTORY THEN
      IF m_FileInfo.cFileName = "." OR m_FileInfo.cFileName = ".." THEN RETURN TRUE
   END IF
END FUNCTION

Pierre Bellisle

  • Junior Member
  • **
  • Posts: 90
Re: CFindFile
« Reply #2 on: September 25, 2019, 10:18:55 AM »

Just for the record: If a filename can legally begin with a dot,
it is interesting to note that it can't end with that character,
except, of course, for "." and ".." folders.
So...
IF ASC(FileName, LEN(FileName)) = 46 THEN this is either "." or ".."
Logged