Capitalization in filenames, and how it affects linux

Post about your mods, learn about OpenMW mod compatibility, check for problematic mods, discuss issues, and give us feedback about your experience with modded OpenMW.
Post Reply
Cammera
Posts: 19
Joined: 08 Oct 2017, 22:35

Capitalization in filenames, and how it affects linux

Post by Cammera »

(I made a thread tangentially related to this several months ago, but now it'd be refloating dead threads and, from my last experience in forums, that's not well liked at all.) I am making the this post here because I am not sure of which other subforum is more apropriate.
This is an issue that affects unix systems, because of the way it deals with capitalization in filenames (Namely, it doesn't) and how this interacts with having multiple data folders. It tripped me up something fierce until I found out the issue exactly; aaa.nif may be in the last folder specified, but aAA.NIF, even thought it's in the first one, is loaded because it's the first file the engine finds, due to how sorting by filename works.

My solution was using convmv, a command line program, to uncapitalize all filenames in my data folders, but this isn't something that new users may be aware of, so I wanted to discuss how to solve it optimally. One solution could be to make OMW's virtual filesystem uncapitalize names automatically (or, unlike unix system, recognize capitalized and uncapitalized characters as the same) but this might add overhead on every single launch. Another one, thought it'd take more work on the user's end or editing the launcher, would be to make convmv's one of OMW's dependencies and add a note about this issue in the launcher, in the active ESPs tab. I thought about adding this note to the wiki, but that may not be as visible to new users.
Or if one wanted to go crazy, just add a button to uncapitalize all names with convmv there. This could be moved to the data folders tab when it's added to the launcher itself, also making convmv only uncapitalize newly added folders to save time.

As a last note I am perfectly aware adding more dependencies to a program in linux isn't usually done willy nilly, and that it may be tempting to just bound a script with OMW that does this instead, but keep in mind that a script will be way, way slower at the work than a proper program for it like convmv is.
User avatar
AnyOldName3
Posts: 2667
Joined: 26 Nov 2015, 03:25

Re: Capitalization in filenames, and how it affects linux

Post by AnyOldName3 »

IIRC, there is an option that disables case folding, so aaa.nif and aAA.nif aren't considered to be the same file, so that's an option. It breaks the vanilla game, though, so it's obviously off by default.

I don't know whether or not it's intentional that perfect case matching in a low priority mod overrides bad case matching in a high priority mod, but it sounds like something that should be discussed. I can think of more reasons against the current system than for it.
Chris
Posts: 1625
Joined: 04 Sep 2011, 08:33

Re: Capitalization in filenames, and how it affects linux

Post by Chris »

AnyOldName3 wrote: 15 May 2018, 01:53 I don't know whether or not it's intentional that perfect case matching in a low priority mod overrides bad case matching in a high priority mod
I don't believe that happens. Certainly it shouldn't, so if it is, it's a bug. But AFAIK, the VFS will search the mod directories in order of priority, doing case-insensitive lookups in each one, until a match is found. An exact case match in a lower-priority directory shouldn't override a case-insensitive match in a higher-priority directory.

Note, however, this only applies to mods installed in multiple data directories, which is the proper way to mod with OpenMW. If a single data directory has two files with the same path/filename just with different cases (e.g. ~/Morrowind/Data Files/Meshes/Foo.nif and ~/Morrowind/Data Files/meshes/foo.nif), no guarantee is made about which one you get because OpenMW has no way to know which you want. It has no idea if Meshes/Foo.nif should have higher priority, or if meshes/foo.nif should.
Post Reply