Is there a way to force a FolderItem reference to be case sensitive?
I open pictures from disk referenced by their file names. But because I’m testing on a case insensitive Mac system, passing a reference to HelloWorld.PNG will successfully open HELLOWORLD.PNG. However on case sensitive systems, which I’m not testing on, this will fail.
Can I force my bad case reference to fail on my Mac system so I can catch these typos?
instead of going straight for it, maybe parse the parent folder
THIS IS UNTESTED CODE, typed straight in here, and may contain syntax or other errors. Treat as pseudocode
dim theFile = folderitem
dim theParent as folderitem
dim theTester as folderitem
dim thename as string
thename = "xyz.extension"
theFile = somepath.child(thename)
if thefile.exists then
theParent = theFile.parent
theFile = nil
for x as integer = 1 to theParent.count
theTester = theParent.child(x)
if StrComp(theTester.name , thename, 0) <> 0 then
theFile = theTester
end if
next
end if
//file is nil if nothing of the same case existed
NOT reference the same file[/quote]
what he said was:
So yes, if you have a case insensitive file system and you use the function I supplied, it’ll tell you if the file you requested does not have exactly the same name… so he can “catch these typos”.