Author Topic: Makeobj png file case-insensitive search on non-Windows systems  (Read 1133 times)

0 Members and 1 Guest are viewing this topic.

Offline 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.

Offline Vladki

Re: Makeobj png file case-insensitive search on non-Windows systems
« Reply #1 on: March 15, 2017, 07:38:14 AM »
This would be very helpful patch. I continually struggle with pak designers that are case insensitive.




Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8830
  • Total likes: 324
  • Helpful: 229
  • Languages: De,EN,JP
Re: Makeobj png file case-insensitive search on non-Windows systems
« Reply #2 on: March 17, 2017, 04:03:22 AM »
I get a 404 error when trying to actually see the attachment?

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4895
  • Total likes: 215
  • Helpful: 108
  • Languages: EN, NO
Re: Makeobj png file case-insensitive search on non-Windows systems
« Reply #3 on: March 17, 2017, 06:42:51 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.

Offline Isaac.Eiland-Hall

  • Benevolent Dictator
  • Administrator
  • *
  • Posts: 3440
  • Total likes: 331
  • Helpful: 91
  • PanamaCityPC.com/support/
    • Facebook Profile
  • Languages: EN
Re: Makeobj png file case-insensitive search on non-Windows systems
« Reply #4 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. :(

Offline dechimal

Re: Makeobj png file case-insensitive search on non-Windows systems
« Reply #5 on: March 17, 2017, 04:30:17 PM »
I attached the patch again.
Is this OK?

edit:
I could get this attachment.
« Last Edit: March 17, 2017, 04:48:31 PM by dechimal »

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2594
  • Total likes: 290
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: Makeobj png file case-insensitive search on non-Windows systems
« Reply #6 on: March 17, 2017, 06:05:14 PM »
It's good now ;)

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8830
  • Total likes: 324
  • Helpful: 229
  • Languages: De,EN,JP
Re: Makeobj png file case-insensitive search on non-Windows systems
« Reply #7 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?

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4895
  • Total likes: 215
  • Helpful: 108
  • Languages: EN, NO
Re: Makeobj png file case-insensitive search on non-Windows systems
« Reply #8 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.

Offline dechimal

Re: Makeobj png file case-insensitive search on non-Windows systems
« Reply #9 on: March 19, 2017, 04:59:59 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?
Also strcaselesscmp is a macro STRCMPI (I think) for good reasons, since this function is system dependend.
_MSC_VER is not equivalent with Windows. It should probably check for _WIN32 like the rest of Simutrans.
That's right.
What does libgen?
It is garbage and not need.
I initially used basename() and dirname().

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2594
  • Total likes: 290
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: Makeobj png file case-insensitive search on non-Windows systems
« Reply #10 on: March 19, 2017, 08:44:59 PM »
Does Simutrans support it yet?
I believe Simutrans never supported that.

Offline dechimal

Re: Makeobj png file case-insensitive search on non-Windows systems
« Reply #11 on: March 20, 2017, 06:16:20 PM »
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.
« Last Edit: March 23, 2017, 07:39:54 PM by dechimal »

Offline Vladki

Re: Makeobj png file case-insensitive search on non-Windows systems
« Reply #12 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.