I was wondering how you could detect what platform a program is running on, I have an application and need it to go to a certain folder depending on whether it is on a Linux or Mac machine.
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It may break in the future, but for now, you can play on a large number of filesystem differences between both.
If you combine several of these path-checking tricks into a function, you can insulate yourself against any one of the tricks failing independently of the others.
You can check for folder existence by using stat.