mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2024-09-11 12:56:03 +03:00
Fixed Glob crash (#1181)
This commit is contained in:
parent
d218ada92f
commit
a10c7c4c24
@ -2,6 +2,10 @@
|
||||
|
||||
## Next Version
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed crash caused by a simultaneous write during a glob processing [#1177](https://github.com/yonaskolb/XcodeGen/issues/1177) @tr1ckyf0x
|
||||
|
||||
## 2.26.0
|
||||
|
||||
### Added
|
||||
|
27
Sources/XcodeGenCore/Atomic.swift
Normal file
27
Sources/XcodeGenCore/Atomic.swift
Normal file
@ -0,0 +1,27 @@
|
||||
//
|
||||
// Atomic.swift
|
||||
//
|
||||
//
|
||||
// Created by Vladislav Lisianskii on 23.02.2022.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
@propertyWrapper
|
||||
struct Atomic<Value> {
|
||||
private let queue = DispatchQueue(label: "com.xcodegencore.atomic")
|
||||
private var value: Value
|
||||
|
||||
init(wrappedValue: Value) {
|
||||
self.value = wrappedValue
|
||||
}
|
||||
|
||||
var wrappedValue: Value {
|
||||
get {
|
||||
return queue.sync { value }
|
||||
}
|
||||
set {
|
||||
queue.sync { value = newValue }
|
||||
}
|
||||
}
|
||||
}
|
@ -57,7 +57,7 @@ public class Glob: Collection {
|
||||
|
||||
public static let defaultBlacklistedDirectories = ["node_modules", "Pods"]
|
||||
|
||||
private var isDirectoryCache = [String: Bool]()
|
||||
@Atomic private var isDirectoryCache = [String: Bool]()
|
||||
|
||||
public let behavior: Behavior
|
||||
public let blacklistedDirectories: [String]
|
||||
|
Loading…
Reference in New Issue
Block a user