Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 20, 2013, 12:19 AM   #1
ArtOfWarfare
macrumors 603
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
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)
ArtOfWarfare is offline   0 Reply With Quote
Old Jan 20, 2013, 12:25 PM   #2
chown33
macrumors 603
 
Join Date: Aug 2009
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.
chown33 is online now   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Automated tool to reveal throttling and overheating - GitHub qnxor MacBook Pro 167 Sep 30, 2014 07:24 AM
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

Forum Jump

All times are GMT -5. The time now is 12:34 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC