General Development

fixing filename case for unix – jari

Jari

Member

Posts: 1471
From: Helsinki, Finland
Registered: 03-11-2005
Hello.
I have this proplem that often comes when trying to use a c++ source code or even a project file made in windows on linux. The problem is that in linux the filename's case matters.
So I was thinking that maybe I should just write a script that reads a file and looks for strings (starting and endidng with ") and attembs to find a file by that string and if it doesn't find it then it tries to find it with different case. After all this it would fix the string containing the file name, in the file.
The problem is that I dont know if you can do a case sensitive file seach and not case sensitive search. Maybe this could be done in python... Or does anyone have better ideas or perhaps already working script/solution?

Thanks... almost wrote a design doc here.

------------------
Psa 32:5 I acknowledged my sin unto thee, and mine iniquity have I not hid. I said, I will confess my transgressions unto the LORD; and thou forgavest the iniquity of my sin. Selah.

[VoHW] (Help needed) [Blog] - Truedisciple (mp3)

Jari

Member

Posts: 1471
From: Helsinki, Finland
Registered: 03-11-2005
Well I almost have it, just don't know how to search for a file in python. Because that is needed for finding out the right case for the file path string.

------------------
Psa 32:5 I acknowledged my sin unto thee, and mine iniquity have I not hid. I said, I will confess my transgressions unto the LORD; and thou forgavest the iniquity of my sin. Selah.

[VoHW] (Help needed) [Blog] - Truedisciple (mp3)

Lazarus

Member

Posts: 1668
From: USA
Registered: 06-06-2006
Jari, could this Python Recipe help:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52224

Jari

Member

Posts: 1471
From: Helsinki, Finland
Registered: 03-11-2005
Thanks Lazarus! I found the script yestarday and I figured that it wasnt what I needed.
I'm trying to write the search function my self now (bleh). well its going alright...

------------------
Psa 32:5 I acknowledged my sin unto thee, and mine iniquity have I not hid. I said, I will confess my transgressions unto the LORD; and thou forgavest the iniquity of my sin. Selah.

[VoHW] (Help needed) [Blog] - Truedisciple (mp3)

samw3

Member

Posts: 542
From: Toccoa, GA, USA
Registered: 08-15-2006
Another possibility would be to wrap the c file functions so that they lowercase the filenames for you. fyi, wrapping is when you write a function that calls the system function you want to call and in the function do the modifications you need to do.

God Bless!

------------------
Sam Washburn

Jari

Member

Posts: 1471
From: Helsinki, Finland
Registered: 03-11-2005
Thanks samw3. In the end I had to accept the fact that it would have saved time to just manually change the file names. Which I did. Parsing the file names for the search turned out to be challenging.

------------------
Psa 32:5 I acknowledged my sin unto thee, and mine iniquity have I not hid. I said, I will confess my transgressions unto the LORD; and thou forgavest the iniquity of my sin. Selah.

[VoHW] (Help needed) [Blog] - Truedisciple (mp3)