From ca4b22e272063852e73503dd8fe45a92352e6adf Mon Sep 17 00:00:00 2001 From: Mark Harrah Date: Wed, 18 Dec 2013 11:35:12 -0500 Subject: [PATCH] Generate an error when making a path string from paths containing the separator. Fixes #1038. This is an attempt to provide a decent error message in some cases. However, paths that include the Java path separator character are just fundamentally problematic and aren't always going to be cleanly detected. --- util/io/src/main/scala/sbt/Path.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/util/io/src/main/scala/sbt/Path.scala b/util/io/src/main/scala/sbt/Path.scala index 479fc5eb4..a21e96bd8 100644 --- a/util/io/src/main/scala/sbt/Path.scala +++ b/util/io/src/main/scala/sbt/Path.scala @@ -68,7 +68,11 @@ object Path extends PathExtra def absolute(file: File): File = new File(file.toURI.normalize).getAbsoluteFile def makeString(paths: Seq[File]): String = makeString(paths, pathSeparator) - def makeString(paths: Seq[File], sep: String): String = paths.map(_.getAbsolutePath).mkString(sep) + def makeString(paths: Seq[File], sep: String): String = { + val separated = paths.map(_.getAbsolutePath) + separated.find(_ contains sep).foreach( p => sys.error(s"Path '$p' contains separator '$sep'") ) + separated.mkString(sep) + } def newerThan(a: File, b: File): Boolean = a.exists && (!b.exists || a.lastModified > b.lastModified) /** The separator character of the platform.*/