|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.)
Don't tell me Macs don't last: 2007 iMac, 2007 Mac Mini, 2008 MacBook Air, all Vintage.
(iMac obsoletion: April 28, 2015, MBA: October 14, 2015, Mac Mini: March 9, 2016)
|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|
|thread||Thread Starter||Forum||Replies||Last Post|
|Automated tool to reveal throttling and overheating - GitHub||qnxor||MacBook Pro||224||Mar 16, 2015 12:49 PM|
|Eve of Impact open sourced on GitHub||rikschennink||iPhone/iPad Programming||0||Oct 30, 2013 03:34 AM|
|Apple script batch shell script||prramesh||Mac Programming||5||Sep 15, 2013 03:35 AM|
|Authenticating GitHub in Xcode?||ArtOfWarfare||Mac Programming||6||Apr 28, 2013 11:44 AM|
All times are GMT -5. The time now is 07:49 PM.