Would you mind changing this to be platform independent?  Something like http://stackoverflow.com/a/9200642/207031 would be good.