News:

The Forum Rules and Guidelines
Our forum has Rules and Guidelines. Please, be kind and read them ;).

Makeobj png file case-insensitive search on non-Windows systems

Started by dechimal, March 15, 2017, 05:14:29 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

dechimal

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.

Vladki

This would be very helpful patch. I continually struggle with pak designers that are case insensitive.

Sent from my ONEPLUS A3003 using Tapatalk


prissi

I get a 404 error when trying to actually see the attachment?

Ters

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.

Isaac Eiland-Hall

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. :(

dechimal

I attached the patch again.
Is this OK?

edit:
I could get this attachment.


prissi

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?

Ters

_MSC_VER is not equivalent with Windows. It should probably check for _WIN32 like the rest of Simutrans.

dechimal

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) 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().

An_dz


dechimal

I corrected the patch.

The updates are:

  • Change the macro of Windows detection from _MSC_VER to _WIN32.
  • Delete include directive of libgen.h.
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.

Vladki

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.

prissi