I have the following code in a program in a Windows 10 environment:
fSourceFile = GetTrueFolderItem (ThisSourcePathFileName)
IF fSourceFile = Nil THEN
IF app.gConfig.LogError THEN
CALL CopyLog ("Error: File Handle for Source File: " + ThisSourcePathFileName )
END IF
ErrorCount = ErrorCount + 1
END IF
The code works, in that it properly traps instances where GetTrueFolderItem returns Nil. However when I examine the log the code creates, GetTrueFolderItem returns Nil for files that do exist. By referencing the log that the code generates, I can use Windows Explorer to navigate to the offending files, and I can open them. Based on the resulting log file, I suspect the offending files have path names that are too long for earlier Windows versions, however I have configured Windows 10 to handle long path names.
I have two questions:
-
How do I get more meaningful information on why GetFolderItem returns Nil (obviously I can not use FolderItem.LastError) that I can put into the log? Right now the log declares a bad file handle (Nil FolderItem), which is not useful to the user. I suspect the long file name is the issue, but I am only guessing.
-
If the long filename is the culprit, how do I retrieve long filenames using GetFolderItem or GetTrueFolderItem, understanding that many users will not have configured their Windows 10 environment to handle long file names (but the code can test for that environment configuration).
Thanks in advance,
Alex