summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-04-13 18:24:27 +0000
committerPaul Phillips <paulp@improving.org>2010-04-13 18:24:27 +0000
commit27288e3ffe2224bb206e79204542c26a2779223b (patch)
tree399a6f78852660a4383db4f5018060eaf8c94329 /src/compiler
parent41d9ea14526b0cf64a5d2146616fd6acf3472e87 (diff)
downloadscala-27288e3ffe2224bb206e79204542c26a2779223b.tar.gz
scala-27288e3ffe2224bb206e79204542c26a2779223b.tar.bz2
scala-27288e3ffe2224bb206e79204542c26a2779223b.zip
A safety improvement for random path generation...
A safety improvement for random path generation, and a small change to Random for a more general interface. Review by community.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/io/Path.scala7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/io/Path.scala b/src/compiler/scala/tools/nsc/io/Path.scala
index 6b88f3cfca..afef38be3c 100644
--- a/src/compiler/scala/tools/nsc/io/Path.scala
+++ b/src/compiler/scala/tools/nsc/io/Path.scala
@@ -9,9 +9,7 @@ import java.io.{
FileInputStream, FileOutputStream, BufferedReader, BufferedWriter, InputStreamReader, OutputStreamWriter,
BufferedInputStream, BufferedOutputStream, RandomAccessFile, File => JFile }
import java.net.{ URI, URL }
-import collection.{ Seq, Traversable }
-import PartialFunction._
-import scala.util.Random.nextASCIIString
+import scala.util.Random.alphanumeric
/** An abstraction for filesystem paths. The differences between
* Path, File, and Directory are primarily to communicate intent.
@@ -71,7 +69,8 @@ object Path
else if (jfile.isDirectory) new Directory(jfile)
else new Path(jfile)
- private[io] def randomPrefix = nextASCIIString(6)
+ /** Avoiding any shell/path issues by only using alphanumerics. */
+ private[io] def randomPrefix = alphanumeric take 6 mkString
private[io] def fail(msg: String) = throw FileOperationException(msg)
}
import Path._