Added check for Mac or Linux

stat functions are different between Mac and Linux.