|Jan 20, 2013, 12:19 AM||#1|
Platform Independent Script after Github Pull?
I have a text file containing a list of relative paths. The text file + the files those paths refer to are all on Github, and will be downloaded by both Windows and OS X users. How can I make it so that when Windows users get it, they'll see their correct path divider (\) and on OS X they'll get their correct path divider (/)?
It seems to me there aught to be some sort of script I can include in my GitHub repository that automatically runs itself and fixes all the paths each time a pull request is completed or something, but I can't for the life of me find it by googling.
Does anyone have any help?
(For what it's worth, this is regarding Android development. The project.properties file is a plain text file that contains paths that the compiler needs so that it can find the correct source files... it requires that the path separators be correct.)
Battery Status - On the Mac App Store
The only app that'll estimate when your wireless devices will need their batteries changed.
Including the ones paired with other Macs on your network.
|Jan 20, 2013, 12:25 PM||#2|
I think I'd just make two files, one with each type of separator. Given them slightly different names, like Win-project.properties for the Windows-based one.
Given a file in /-separated form, it should be simple to write a script that converts to \-separated form, including any \-escaping that might (or might not) need to occur.
The 'tr' command can easily do single-character transliteration. So that would be my 1st choice for the / to \ conversion. If there were other things, like prepending C: or whatever, I might choose a different tool, or do the conversion in stages. Hard to say without seeing the actual data.
Oh, and I might file a feature-request against the Android dev tool to add a platform-neutral pathname capability. This is a solved problem. See the RFC for URLs and URIs, where the separator is always /, even if the server uses something else natively.
|Thread Tools||Search this Thread|
All times are GMT -5. The time now is 05:41 AM.