Skip to content

Commit 674f9ed

Browse files
authored
Merge pull request #16 from Flogex/remove-local-path-check
Remove `isFileURL` check in `Database` constructor
2 parents 92f578c + 8c37f90 commit 674f9ed

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

Sources/DuckDB/Database.swift

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,11 @@ public final class Database: Sendable {
8080
public convenience init(
8181
store: Store = .inMemory, configuration: Configuration? = nil
8282
) throws {
83-
var fileURL: URL?
84-
if case .file(let url) = store {
85-
guard url.isFileURL else {
86-
throw DatabaseError.databaseFailedToInitialize(
87-
reason: "provided URL for database store file must be local")
88-
}
89-
fileURL = url
90-
}
91-
try self.init(path: fileURL?.path, config: configuration)
83+
let path: String? = {
84+
guard case .file(let url) = store else { return nil }
85+
return url.path
86+
}()
87+
try self.init(path: path, config: configuration)
9288
}
9389

9490
private init(path: String?, config: Configuration?) throws {

0 commit comments

Comments
 (0)