Force FolderItem to be Case Sensitive?

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?

Create a new disk image with a case sensitive file system (either HFS+ or APFS) and use this for testing.

You can do this with a simple StrComp. If you use a method for opening images:

[code]Public Function LoadImage(name as string) as Picture
dim f as FolderItem = app.ExecutableFile.Parent.Child(“Resources”).Child(name)

if StrComp(name, f.name, 0) <> 0 then
break
end if

Return Picture.Open(f)
End Function[/code]

Greg that doesn’t help, since the compare is done AFTER the fact.
I think the OP wants to be able to

f=getFolderItem("THISISAFILENAME.PNG")
f2=getFolderitem("thisisafilename.png")

NOT reference the same file

urggghhhh… but…

Given a filename xyz.extension

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

[quote=377854:@Dave S]Greg that doesn’t help, since the compare is done AFTER the fact.
I think the OP wants to be able to

f=getFolderItem("THISISAFILENAME.PNG")
f2=getFolderitem("thisisafilename.png")

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”.

But he has to check the entire path no ? If its content folder has not the same case ?

Yes, but that should be very easy to isolate… unless every bit of every path was unique.