0gb.us wrote:No, but no need. I've created a new plugin, filesystems_0gb_us, which should do the trick. While not perfect, it provides a sort of pseudo-case sensitivity. If it finds an INIT.LUA (only init.lua should exist), it switches to Windows workaround mode, and translates every character in the file name into a two-character representation, allowing "a" to become "-a", and "A" to become "+A". Because Linux actually functions in a reasonable manner, this translation is not performed on Linux operating systems by default, but can be activated by adding an INIT.LUA to the plugin's directory.
If the hash does collide, you would be insanely famous in the crypto community. It's also quite small, anywhere from 16 to 64 bytes. If you DO keep it in memory, you don't need to rehash each time the file is updated.
You should also make filesystems_0gb_us an API for other mods. I'm assuming user names don't allow + and - in Minetest.
I understand IF I keep them in memory I can reuse the hashes. My whole point is that I'm not doing it. The reason I'm using separate files for each user is to keep memory usage to a minimum. I can load a user's file when they log in, and unload it when they log out.
The maximum mangled user name with my system would be 38 bytes. More than 16 bytes, but less than 64. And that's just the maximum. The minimum would be two byes, and my six character name would be twelve byes..
filesystems_0gb_us is ALREADY an API for other plugins. It's entire purpose is to define a single function to make file names work on the Windows operating system without needing to reinvent the feature each time I need it, as I need it for three plugins already. Just out of curiosity, what did you think it was doing to make other plugins "compatible", if not defining an API?
0gb.us wrote:... it switches to Windows workaround mode, and translates every character in the file name into a two-character representation ,..
The minus character is allowed in user names, but it doesn't matter. I said EVERY character is converted to a two character representation, it's not just alphabetic characters. + becomes ++, and - becomes --. All non-alphabetic characters are doubled. This seems like a needless extension of file names, but I disagree. This makes it very easy for a script to go through and translate them back for use on file systems that actually work correctly. All the script has to do is keep every other character, throwing out the others. Furthermore, this is just a workaround to make sure suborn Windows users don't take my non-compatible plugin and screw up their game worlds. If people want user friendly file names, they should quit using an operating system that is so un- user friendly in every way. This isn't meant to be a compatibility fix. Mangled names, especially irreversibly mangled by hashing, is too hacky a method to be considered "compatible". The only goal here is to not be responsible for data loss/data manipulation. Windows users STILL should not install these, and they DO raise errors when run on Windows. For the time being, I don't know how to fix that.
Besides, does Lua have any hashing functions? I couldn't find any.