The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: dechimal on March 15, 2017, 05:14:29 AM

Title: Makeobj png file case-insensitive search on non-Windows systems
Post by: dechimal on March 15, 2017, 05:14:29 AM
This patch for non-Windows systems makeobjs will change to try case-insensitive search if failed to open the image file.

Some dat files created on Windows don't consider case of image names.
Since it causes a png file not found error to running makeobj with such dat files on non-Windows systems, I propose the patch.
Title: Re: Makeobj png file case-insensitive search on non-Windows systems
Post by: Vladki on March 15, 2017, 07:38:14 AM
This would be very helpful patch. I continually struggle with pak designers that are case insensitive.

Sent from my ONEPLUS A3003 using Tapatalk

Title: Re: Makeobj png file case-insensitive search on non-Windows systems
Post by: prissi on March 17, 2017, 04:03:22 AM
I get a 404 error when trying to actually see the attachment?
Title: Re: Makeobj png file case-insensitive search on non-Windows systems
Post by: Ters on March 17, 2017, 06:42:51 AM
Quote from: prissi on March 17, 2017, 04:03:22 AM
I get a 404 error when trying to actually see the attachment?

Me too. Since it is an attachment to the post, that is something for Isaac to look into.
Title: Re: Makeobj png file case-insensitive search on non-Windows systems
Post by: Isaac Eiland-Hall on March 17, 2017, 09:53:22 AM
If SMF had some reasonable way of handling attachments. After the last forum problem when I tried to find out how they worked and nobody at SMF would deign to tell me, attachments are magic: when they go wrong, they just go wrong. :(
Title: Re: Makeobj png file case-insensitive search on non-Windows systems
Post by: dechimal on March 17, 2017, 04:30:17 PM
I attached the patch again.
Is this OK?

edit:
I could get this attachment.
Title: Re: Makeobj png file case-insensitive search on non-Windows systems
Post by: An_dz on March 17, 2017, 06:05:14 PM
It's good now ;)
Title: Re: Makeobj png file case-insensitive search on non-Windows systems
Post by: prissi on March 18, 2017, 12:30:02 PM
Not sure this will always work. I think I have seen case sensitive file systems with : as separator, like MAC HFS. Also strcaselesscmp is a macro STRCMPI (I think) for good reasons, since this function is system dependend. What does libgen?
Title: Re: Makeobj png file case-insensitive search on non-Windows systems
Post by: Ters on March 18, 2017, 12:46:30 PM
_MSC_VER is not equivalent with Windows. It should probably check for _WIN32 like the rest of Simutrans.
Title: Re: Makeobj png file case-insensitive search on non-Windows systems
Post by: dechimal on March 19, 2017, 04:59:59 PM
Quote from: prissi on March 18, 2017, 12:30:02 PM
I think I have seen case sensitive file systems with : as separator, like MAC HFS.
I confirmed with https://en.wikipedia.org/wiki/Path_(computing) (https://en.wikipedia.org/wiki/Path_(computing)) and Makefile.
I think that it is only old Mac to a system that path separator is not / and relating with Simutrans. Does Simutrans support it yet?
Quote from: prissi on March 18, 2017, 12:30:02 PM
Also strcaselesscmp is a macro STRCMPI (I think) for good reasons, since this function is system dependend.
Quote from: Ters on March 18, 2017, 12:46:30 PM
_MSC_VER is not equivalent with Windows. It should probably check for _WIN32 like the rest of Simutrans.
That's right.
Quote from: prissi on March 18, 2017, 12:30:02 PM
What does libgen?
It is garbage and not need.
I initially used basename() and dirname().
Title: Re: Makeobj png file case-insensitive search on non-Windows systems
Post by: An_dz on March 19, 2017, 08:44:59 PM
Quote from: dechimal on March 19, 2017, 04:59:59 PM
Does Simutrans support it yet?
I believe Simutrans never supported that.
Title: Re: Makeobj png file case-insensitive search on non-Windows systems
Post by: dechimal on March 20, 2017, 06:16:20 PM
I corrected the patch.

The updates are:
I didn't change the path separator since support for old Mac seems unnecessary.

I noticed that it was not considered to filename automatic normalization of Mac HFS+.
However, I cannot correct because I have no Mac...

Edit:
Support for its normalization is not need, since it does not increase files that cannot be opened.
Title: Re: Makeobj png file case-insensitive search on non-Windows systems
Post by: Vladki on March 26, 2017, 09:32:12 AM
This is indeed very useful patch. I have seen several addon makers who use only windows, and thus are not aware that there are case-sensitive OS's. I hope it will be accepted to both simutrans standard and extended.
Title: Re: Makeobj png file case-insensitive search on non-Windows systems
Post by: prissi on September 10, 2018, 02:39:47 PM
Incorporated in r8572, thank you very much.