Broken Sword 2 default directories name

Ask for help with ScummVM problems

Moderator: ScummVM Team

Post Reply
howl
Posts: 24
Joined: Sun Nov 23, 2008 2:53 am

Broken Sword 2 default directories name

Post by howl »

Could be added into "engines/sword2/sword2.cpp" line 268
+ Common::File::addDefaultDirectory(_gameDataDir.getChild("Clusters"));
+ Common::File::addDefaultDirectory(_gameDataDir.getChild("Sword2"));
+ Common::File::addDefaultDirectory(_gameDataDir.getChild("Video"));
+ Common::File::addDefaultDirectory(_gameDataDir.getChild("Smacks"));

the first capital letter is by default in at least come cd versions of Broken Sword 2 and I don't know in windows, but in unix and other case sensitive os sword2 engine can't find the game files without renaming the default names.

User avatar
md5
ScummVM Developer
Posts: 2261
Joined: Thu Nov 03, 2005 9:31 pm
Location: Athens, Greece

Re: Broken Sword 2 default directories name

Post by md5 »

howl wrote:Could be added into "engines/sword2/sword2.cpp" line 268
+ Common::File::addDefaultDirectory(_gameDataDir.getChild("Clusters"));
+ Common::File::addDefaultDirectory(_gameDataDir.getChild("Sword2"));
+ Common::File::addDefaultDirectory(_gameDataDir.getChild("Video"));
+ Common::File::addDefaultDirectory(_gameDataDir.getChild("Smacks"));

the first capital letter is by default in at least come cd versions of Broken Sword 2 and I don't know in windows, but in unix and other case sensitive os sword2 engine can't find the game files without renaming the default names.
That's odd, I thought that ScummVM's file system is always case-insensitive. At least it is when it comes to files, but from what you say, it looks that it isn't for directories

User avatar
LordHoto
ScummVM Developer
Posts: 1030
Joined: Sun Oct 30, 2005 3:58 pm
Location: Germany

Post by LordHoto »

It never was for directories in that use actually. That is because the code shown here is using FSNode, which is case sensitive (at least when the operating system's filesystem is case sensitive too).

We actually used to have a description in the README (IIRC), which said that files should be either all lowercase or all uppercase, but I can't find it anymore...

howl
Posts: 24
Joined: Sun Nov 23, 2008 2:53 am

Re: Broken Sword 2 default directories name

Post by howl »

md5 wrote: That's odd, I thought that ScummVM's file system is always case-insensitive. At least it is when it comes to files, but from what you say, it looks that it isn't for directories
Yes, for regular files the case doesn't matter, only for directories.
md5 wrote: We actually used to have a description in the README (IIRC), which said that files should be either all lowercase or all uppercase, but I can't find it anymore...
Well in this case I'm talking about the default names, that are Capitalised. I don't think that any game use similar folder names only differing in the case. Could FSNode be made to be case insensitive and then removing inecesary lines like Common::File::addDefaultDirectory(_gameDataDir.getChild("clusters")); and Common::File::addDefaultDirectory(_gameDataDir.getChild("CLUSTERS")); leaving only one of them, or, at least add this naming exception for sword2?

User avatar
LordHoto
ScummVM Developer
Posts: 1030
Joined: Sun Oct 30, 2005 3:58 pm
Location: Germany

Post by LordHoto »

No FSNode is a low level API, it's specifically designed to be as close as possible to the underling FS. Its degree of abstraction is only minimal compared to the SearchMan API, which is used to access files.

Actually that exception could be added to SWORD2, it would be only confusing if SWORD2 would be the only engine to allow such directory names. It would be probably easier to just name all uppercase/lowercase.

fingolfin
Retired
Posts: 1466
Joined: Wed Sep 21, 2005 4:12 pm

Post by fingolfin »

It would be easier for us developers to force users to use only all lowercase or all uppercase, but that's a bad excuse I think :).

In my eyes the "long term plan" always was to replace this Common::File::addDefaultDirectory() voodoo with something cleaner that is case agnostic.

User avatar
LordHoto
ScummVM Developer
Posts: 1030
Joined: Sun Oct 30, 2005 3:58 pm
Location: Germany

Post by LordHoto »

fingolfin wrote:It would be easier for us developers to force users to use only all lowercase or all uppercase, but that's a bad excuse I think :).
Actually that's the same bad excuse as we officially had for all filenames for some time in the past ;-). And that hacky way to also add dirs with only the first character being uppercase doesn't really help the whole thing either...

Also with the FSNode API being case sensitive we can display the users warnings of possible filename glitches (as we do currently via stderr btw.), which wouldn't be possible with a case sensitive API (EXCEPT with every FS implementation doing the same thing of course... ;-)
fingolfin wrote:In my eyes the "long term plan" always was to replace this Common::File::addDefaultDirectory() voodoo with something cleaner that is case agnostic.
Never said anything against that. It was solely that making the FSNode case insensitive is the wrong way to go IMHO. So for now it's just easier to have only uppercase or lowercase directory names as user.

fingolfin
Retired
Posts: 1466
Joined: Wed Sep 21, 2005 4:12 pm

Post by fingolfin »

LordHoto wrote:
fingolfin wrote:It would be easier for us developers to force users to use only all lowercase or all uppercase, but that's a bad excuse I think :).
Actually that's the same bad excuse as we officially had for all filenames for some time in the past ;-). And that hacky way to also add dirs with only the first character being uppercase doesn't really help the whole thing either...
Exactly! We do this lame thing in other places, too, you are right. So things are even worse *sigh*. But of course it would be wrong to add tons of addDefaultDir calls to attack this. Just as it would be wrong to modify FSNode for this. :)
LordHoto wrote:Also with the FSNode API being case sensitive we can display the users warnings of possible filename glitches (as we do currently via stderr btw.), which wouldn't be possible with a case sensitive API (EXCEPT with every FS implementation doing the same thing of course... ;-)
Indeed. Which is why we shouldn't modify FSNode to be case sensitive. :)
LordHoto wrote:
fingolfin wrote:In my eyes the "long term plan" always was to replace this Common::File::addDefaultDirectory() voodoo with something cleaner that is case agnostic.
Never said anything against that. It was solely that making the FSNode case insensitive is the wrong way to go IMHO. So for now it's just easier to have only uppercase or lowercase directory names as user.
Ah, great then. I understood your suggestion for the user to rename all his files differently. But it seems we are on the same line with this after all. So, if you've got good idea on how to attack this once and for all, let's discuss them -- although maybe on -devel and not here :). I'll write an email

howl
Posts: 24
Joined: Sun Nov 23, 2008 2:53 am

Post by howl »

Well, the naming as I said is the one that comes with my broken sword 2 cd, so when copying the files didn't work at first. I notice about the case issue and could fix the problem renaming to lower case.

Thinking about it, if making FSNode to be able to handle in a case insensitive way folder names is not possible, could no be right to add the default naming to the only lower case and only upper case rule?

This could make that the users don't have to investigate why the game is not working by simply copying the necessary files.

User avatar
LordHoto
ScummVM Developer
Posts: 1030
Joined: Sun Oct 30, 2005 3:58 pm
Location: Germany

Post by LordHoto »

I just noticed it seems that the part saying that everything should be either all upper-case or lower-case was removed with r28830. Here's the log for that commit http://scummvm.svn.sourceforge.net/view ... 3&r2=28830

Actually it seems the information wasn't that nice placed back then either ;-).

howl
Posts: 24
Joined: Sun Nov 23, 2008 2:53 am

Post by howl »

LordHoto wrote:I just noticed it seems that the part saying that everything should be either all upper-case or lower-case was removed with r28830. Here's the log for that commit http://scummvm.svn.sourceforge.net/view ... 3&r2=28830

Actually it seems the information wasn't that nice placed back then either ;-).
The README warned about filenames in files not in directories, nowadays doesn't matter the case in files, for the same Broken Sword 2 I have files with mixed naming scheme, with all lower case, capital and all upper case as they come in the original, and scummvm loads all of them right.

The only problem is the directories so if you want to take the notice back could be edited to warn about only the directories all upper case and all lower case, to avoid the users to use scripts for renaming the whole gamefiles or by hand.

I think that when the info was removed from the README the intentions was to make scummvm case insensitive? :P xD

User avatar
LordHoto
ScummVM Developer
Posts: 1030
Joined: Sun Oct 30, 2005 3:58 pm
Location: Germany

Post by LordHoto »

howl wrote: The README warned about filenames in files not in directories, nowadays doesn't matter the case in files, for the same Broken Sword 2 I have files with mixed naming scheme, with all lower case, capital and all upper case as they come in the original, and scummvm loads all of them right.
Actually with filenames both files and directories were meant ;-).
howl wrote: I think that when the info was removed from the README the intentions was to make scummvm case insensitive? :P xD
Yes, there was a change, which allowed filenames of *any* case to be used, instead of filenames only uppercase or only lowercase. Probably while removing it nobody thought about directories still requiring that ;-).

Post Reply