Skip to content

Commit

Permalink
Open and create files through OuisyncRepository API
Browse files Browse the repository at this point in the history
  • Loading branch information
inetic committed Jun 19, 2024
1 parent 1ab9ee8 commit 3c94c26
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,11 @@ public class OuisyncFileEntry {
}

public func open() async throws -> OuisyncFile {
let fileHandle = try await repository.session.sendRequest(.fileOpen(repository.handle, path)).toUInt64()
return OuisyncFile(fileHandle, repository)
try await repository.openFile(path)
}

public func create() async throws -> OuisyncFile {
let fileHandle = try await repository.session.sendRequest(.fileCreate(repository.handle, path)).toUInt64()
return OuisyncFile(fileHandle, repository)
try await repository.createFile(path)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ public class OuisyncRepository: Hashable, CustomDebugStringConvertible {
return OuisyncFile(handle, self)
}

public func openFile(_ path: FilePath) async throws -> OuisyncFile {
let handle = try await session.sendRequest(.fileOpen(handle, path)).toUInt64()
return OuisyncFile(handle, self)
}

public func deleteFile(_ path: FilePath) async throws {
let _ = try await session.sendRequest(.fileRemove(handle, path))
}
Expand Down

0 comments on commit 3c94c26

Please sign in to comment.