Files
ventywing c4c415d870 Fix duplication of update for Playground app
Fix duplication of update for Playground app
2023-03-01 13:39:12 +03:00

20 lines
622 B
Swift

import Foundation
enum RegressionFile {
static let regressionPath = "regression_test_data"
static func makeUrl(_ relativeFileName: String) -> URL? {
let path: String
let fileName: String
if let slashIndex = relativeFileName.lastIndex(of: "/") {
path = regressionPath + "/" + relativeFileName.prefix(upTo: slashIndex)
fileName = String(relativeFileName.suffix(from: relativeFileName.index(after: slashIndex)))
} else {
path = regressionPath
fileName = relativeFileName
}
return Bundle.main
.url(forResource: fileName, withExtension: "", subdirectory: path)
}
}