File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ public class SwiftAstGenerator {
7
7
private var prettyPrint : Bool
8
8
private let availableProcessors = ProcessInfo . processInfo. activeProcessorCount
9
9
10
+ // Private serial queue for directory creation operations
11
+ private let fileQueue = DispatchQueue ( label: " io.joern.swiftastgen " )
12
+
10
13
public init ( srcDir: URL , outputDir: URL , prettyPrint: Bool ) throws {
11
14
self . srcDir = srcDir
12
15
self . outputDir = outputDir
@@ -45,11 +48,13 @@ public class SwiftAstGenerator {
45
48
let outfileDirUrl = outFileUrl. deletingLastPathComponent ( )
46
49
47
50
do {
48
- try FileManager . default. createDirectory (
49
- atPath: outfileDirUrl. path,
50
- withIntermediateDirectories: true ,
51
- attributes: nil
52
- )
51
+ try fileQueue. sync {
52
+ try FileManager . default. createDirectory (
53
+ atPath: outfileDirUrl. path,
54
+ withIntermediateDirectories: true ,
55
+ attributes: nil
56
+ )
57
+ }
53
58
} catch { }
54
59
55
60
try astJsonString. write (
You can’t perform that action at this time.
0 commit comments