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 {
77 private var prettyPrint : Bool
88 private let availableProcessors = ProcessInfo . processInfo. activeProcessorCount
99
10+ // Private serial queue for directory creation operations
11+ private let fileQueue = DispatchQueue ( label: " io.joern.swiftastgen " )
12+
1013 public init ( srcDir: URL , outputDir: URL , prettyPrint: Bool ) throws {
1114 self . srcDir = srcDir
1215 self . outputDir = outputDir
@@ -45,11 +48,13 @@ public class SwiftAstGenerator {
4548 let outfileDirUrl = outFileUrl. deletingLastPathComponent ( )
4649
4750 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+ }
5358 } catch { }
5459
5560 try astJsonString. write (
You can’t perform that action at this time.
0 commit comments