ParseFolderName: if filename part of path then not returning correct path
I found a possible bug using ParseFolderName function.
If the contents of sFile is part of the direcories names in sFileName, the replace function change the first ocurrence of the substring.
To fix this a replaced the line:
Move (Replace(sFile,sFileName,"")) To sFolderName
Move (Left(sFileName,Length(sFileName)-Length(sFile))) to sFolderName
Hope I made myself clear.
Thanks in advance.
Have a nice day.
#1 Updated by Wil van Antwerpen over 6 years ago
- Status changed from New to Resolved
- Assignee set to Wil van Antwerpen
As replace was used to trim the filename from the path it ended up replacing the first occurence which was the path and not the filename.
Eg. it would do this:
C:\test.txt\test.txt -> C:\test.txt
C:\mytest.txt\test.txt -> c:\my\test.txt
This has been fixed. Thanks Clayton!