blob: 99a8ca2b1f23657d1c456f7260fe3d0db35b62d7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
package scala.scalajs.tools.classpath.builder
import scala.scalajs.tools.io._
import scala.collection.immutable.Traversable
import java.io.{InputStream, Reader}
/** Abstraction of a FileSystem, so classpath builders can be used with virtual
* file systems
*/
trait FileSystem {
type File
/** Dummy version constant to identify files for which a version can not be
* found.
* This constant should never collide with the result of getVersion.
*/
val DummyVersion: String
def isDirectory(f: File): Boolean
def isFile(f: File): Boolean
def isJSFile(f: File): Boolean
def isIRFile(f: File): Boolean
def isJARFile(f: File): Boolean
def exists(f: File): Boolean
def getName(f: File): String
/** A string that uniquely identifies this file's location */
def getAbsolutePath(f: File): String
/** A string that identifies the version of a file: If it equals the version
* of another file with the same absolute path, the two files must be equal.
* This is usually the lastModified date, but ordering is not required
*/
def getVersion(f: File): String
/** A string that globally identifies the version of a file: If it equals the
* global version of any other file, they must equal.
*/
def getGlobalVersion(f: File): String =
CacheUtils.joinVersions(getAbsolutePath(f), getVersion(f))
/** A string that globally identifies a file for which a version can not be
* found. Example: a file that does not exists.
*/
def getDummyVersion(f: File): String =
CacheUtils.joinVersions(getAbsolutePath(f), DummyVersion)
/** List files in a directory */
def listFiles(d: File): Traversable[File]
def toJSFile(f: File): VirtualJSFile
def toIRFile(f: File): VirtualScalaJSIRFile
def toReader(f: File): Reader
def toInputStream(f: File): InputStream
}
|