File tree Expand file tree Collapse file tree 2 files changed +4
-12
lines changed Expand file tree Collapse file tree 2 files changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -28,19 +28,13 @@ enum IDLBuilder {
28
28
]
29
29
30
30
static let outDir = " Sources/DOMKit/WebIDL/ "
31
- static func writeFile( named name: String , content: String ) throws {
31
+ static func writeFile( named name: String , content: String ) throws -> String {
32
32
let path = outDir + name + " .swift "
33
33
if FileManager . default. fileExists ( atPath: path) {
34
- fatalError ( " file already exists for \( name) " )
35
- } else {
36
- try ( preamble + content) . write ( toFile: path, atomically: true , encoding: . utf8)
37
- }
38
- }
39
-
40
- static func cleanOutputFolder( ) throws {
41
- for file in try FileManager . default. contentsOfDirectory ( atPath: outDir) {
42
- try FileManager . default. removeItem ( atPath: outDir + file)
34
+ try FileManager . default. removeItem ( atPath: path)
43
35
}
36
+ try ( preamble + content) . write ( toFile: path, atomically: true , encoding: . utf8)
37
+ return path
44
38
}
45
39
46
40
static func generateIDLBindings( idl: [ GenericCollection < IDLNode > ] ) throws -> SwiftSource {
Original file line number Diff line number Diff line change @@ -7,8 +7,6 @@ func main() {
7
7
do {
8
8
let startTime = Date ( )
9
9
let idl = try IDLParser . parseIDL ( )
10
- print ( " Removing old files... " )
11
- try IDLBuilder . cleanOutputFolder ( )
12
10
var contents : [ SwiftSource ] = [ ]
13
11
print ( " Generating bindings... " )
14
12
contents. append ( try IDLBuilder . generateIDLBindings ( idl: idl) )
You can’t perform that action at this time.
0 commit comments