I’ve been working on my Mac doing development and have noticed several times that I end up with case sensitivity problems when moving my code the live environment. Since Linux filesystems are by default case-sensitive and Mac’s HFS isn’t, I forget to pay attention to the case of my ‘event.setView’ commands and the relationship between the convention-based view location for handlers. Inevitably, I have to go back through all of my view folders and handlers and make sure case matches.
So, my question is, does it seem like a decent idea to add a case-insensitive search for views? Since handlers and cf in general seems to be case insensitive, it seems out of place to make this ONE aspect of our applications so dependent on case.
Anyone have an opinion?
Honestly, that is just something you need to keep in mind when working on cross platform systems.
We had the same problem with version control. Develop on case insensitive windows platform with central repository on linux.
If you change the case of a file already in repository and you submit to repository you will be in trouble.
Convention Is what will save you, always use the same filenaming convention consistently and you will not run into this problem.
Tom Van Schoor
In fact it is not coldbox that treats this case sensitive… It is linux. That is why it will work on your mac but not on your server. On your mac your views folder can be called View, vIew, viEw or whatever. Your coldbox will find the folder. Remember that your coldfusion uses the underlying operatingh system to find the file… Linux searches case sensitive and that is the way it is.
I understand that this is a different behavior in each OS, I should and can work around this issue by being extra careful, and the case sensitivity isn’t CF’s “fault.” I just wondered if automatically compensating for any case issues would be a good idea.
FIn RequestContext.cfc, the Layout file lookup uses a case insensitive lookup. e.g., if I use (main.cfm or Main.cfm) as my layout, both work. The same thing happens throughout the application for events, cache keys, etc. Just not views.
Since case-insensitivity seems to be a consistent theme throughout coldbox, i’m thinking that extending it to the view search makes sense.
In my opinion that is imposible. In cf you can put everything in lowercase before comparing. That is how these things are usually handled, but you can’t tell the operating system to now look for files case insensitive.
You could look for every possible case of the file and if it doesn’t exist look for a different case of the file but this is not possible as there are too many combinations of lower - upper case.
It is not something that cf or cb can solve.
If upon initialization CB populated a list with all view paths, listfindnocase could e used to lookup the actual file path. While the initial list population might be a tad expensive, I wonder how it compares to the file system check that is currently being performed.
This is actually how the layouts are handled now.
It is certainly possible…