@@ -30,7 +30,6 @@ import scala.io.Source
3030import scala .reflect .ClassTag
3131
3232import com .google .common .io .Files
33- import org .apache .commons .lang .SystemUtils
3433import com .google .common .util .concurrent .ThreadFactoryBuilder
3534import org .apache .hadoop .fs .{FileSystem , FileUtil , Path }
3635import org .json4s ._
@@ -49,7 +48,7 @@ private[spark] object Utils extends Logging {
4948 val random = new Random ()
5049
5150 def sparkBin (sparkHome : String , which : String ): File = {
52- val suffix = if (SystemUtils . IS_OS_WINDOWS ) " .cmd" else " "
51+ val suffix = if (isWindows ) " .cmd" else " "
5352 new File (sparkHome + File .separator + " bin" , which + suffix)
5453 }
5554
@@ -609,7 +608,7 @@ private[spark] object Utils extends Logging {
609608 */
610609 def isSymlink (file : File ): Boolean = {
611610 if (file == null ) throw new NullPointerException (" File must not be null" )
612- if (SystemUtils . IS_OS_WINDOWS ) return false
611+ if (isWindows ) return false
613612 val fileInCanonicalDir = if (file.getParent() == null ) {
614613 file
615614 } else {
@@ -1013,7 +1012,7 @@ private[spark] object Utils extends Logging {
10131012 throw new IOException (" Destination must be relative" )
10141013 }
10151014 var cmdSuffix = " "
1016- val linkCmd = if (SystemUtils . IS_OS_WINDOWS ) {
1015+ val linkCmd = if (isWindows ) {
10171016 // refer to http://technet.microsoft.com/en-us/library/cc771254.aspx
10181017 cmdSuffix = " /s /e /k /h /y /i"
10191018 " cmd /c xcopy "
@@ -1056,4 +1055,11 @@ private[spark] object Utils extends Logging {
10561055 def getHadoopFileSystem (path : String ): FileSystem = {
10571056 getHadoopFileSystem(new URI (path))
10581057 }
1058+
1059+ /**
1060+ * return true if this is Windows.
1061+ */
1062+ def isWindows = Option (System .getProperty(" os.name" )).
1063+ map(_.startsWith(" Windows" )).getOrElse(false )
1064+
10591065}
0 commit comments