Jump to content
  • Advertisement
Sign in to follow this  
supagu

[linux] case insensitive opening file

This topic is 4088 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

im porting code from windows to linux and then it dawns on me my data isnt loading as linux is case sensitive! so now i have to port my data! is there anyway i can do a canse insensitive fopen in c/c++ for linux?

Share this post


Link to post
Share on other sites
Advertisement
Not to my knowledge.
But is it so big a problem to have the names passed to fopen reflect the actual case-sensitive filenames?

Share this post


Link to post
Share on other sites
Let's say your application uses ResourceManager application. RM for short.

You call that application as RM -r under windows, and it will rebuild the index.

Now on linux you can't, since caps matter. So rather than complicate, you simply convert everything to lower or upper case, it doesn't matter.

So then you just end up running rm -r. And hilarity ensues.

Different capitalization means different files. Converting blindly between the two is Bad Idea(tm). Especially if running as root.

[BAD IDEA]
One way to do it is to convert your filenames to lowercase, then pass lowercase strings to fopen.
[BAD IDEA]

Other than that, manually change the filenames to be consistent. This has nothing to do with C++, but prevents a whole bunch of problems.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!