File tree 3 files changed +9
-10
lines changed
importer-portable/src/main/scala/org/scalablytyped/converter/internal/importer
3 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -9,12 +9,12 @@ import scala.util.Try
9
9
object GlobWalker {
10
10
11
11
/**
12
- * Traverses the base directory and returns all files that match a given glob.
13
- *
14
- * Only returns files, not directories. If a directory matches a glob then all its descendents are included.
15
- *
16
- * @see the glob syntax in [[java.nio.file.FileSystem#getPathMatcher ]]
17
- */
12
+ * Traverses the base directory and returns all files that match a given glob.
13
+ *
14
+ * Only returns files, not directories. If a directory matches a glob then all its descendents are included.
15
+ *
16
+ * @see the glob syntax in [[java.nio.file.FileSystem#getPathMatcher ]]
17
+ */
18
18
def walkFiles (baseDirectory : os.Path , globs : IArray [String ]): IndexedSeq [os.Path ] = {
19
19
val pathOrMatchers = globs.map { glob =>
20
20
Try (FileSystems .getDefault.getPathMatcher(s " glob: $glob" )).toOption.toRight(baseDirectory / glob)
@@ -30,15 +30,14 @@ object GlobWalker {
30
30
31
31
val builder = IndexedSeq .newBuilder[os.Path ]
32
32
33
- def processDirectoryAndSkip (dir : os.Path ): Boolean = {
33
+ def processDirectoryAndSkip (dir : os.Path ): Boolean =
34
34
if (matches(dir)) {
35
35
os.walk.stream(dir).generate { path =>
36
36
if (path.toIO.isFile) builder += path
37
37
Generator .Continue
38
38
}
39
39
true
40
40
} else false
41
- }
42
41
43
42
os.walk.stream(baseDirectory, processDirectoryAndSkip).generate { path =>
44
43
if (path.toIO.isFile && matches(path)) builder += path
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ object LibTsSource {
50
50
51
51
def fromFilesGlobEntry (fromFolder : LibTsSource .FromFolder , globs : Option [IArray [String ]]): IArray [InFile ] = {
52
52
val baseDirectory = fromFolder.folder.path
53
- val files = globs.fold(os.walk(baseDirectory))(GlobWalker .walkFiles(baseDirectory, _)).map(InFile (_))
53
+ val files = globs.fold(os.walk(baseDirectory))(GlobWalker .walkFiles(baseDirectory, _)).map(InFile (_))
54
54
IArray .fromTraversable(files)
55
55
}
56
56
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ class Phase1ReadTypescript(
57
57
f.shortenedFiles
58
58
case f : LibTsSource .FromFolder =>
59
59
/* There are often whole trees parallel to what is specified in `typings` (or similar). This ignores some of them. */
60
- val bound = f.shortenedFiles.map(_.folder).distinct
60
+ val bound = f.shortenedFiles.map(_.folder).distinct
61
61
val boundOrParent = if (bound.isEmpty) IArray (f.folder) else bound
62
62
boundOrParent.flatMap(PathsFromTsLibSource .filesFrom).distinct
63
63
}
You can’t perform that action at this time.
0 commit comments