New Repo method optionally return the filesystem path to an item.

This commit is contained in:
Greg Neagle
2024-09-13 18:46:49 -07:00
parent 1581773a25
commit e8111f0a3d
2 changed files with 18 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
//
// main.swift
// iconimporter
//
// Created by Greg Neagle on 9/13/24.
//
import Foundation
print("Hello, World!")

View File

@@ -30,6 +30,7 @@ protocol Repo {
func put(_ identifier: String, content: Data) throws
func put(_ identifier: String, fromFile local_file_path: String) throws
func delete(_ identifier: String) throws
func pathFor(_ identifier: String) -> String?
}
// MARK: share mounting functions
@@ -286,4 +287,10 @@ class FileRepo: Repo {
func delete(_ identifier: String) throws {
try FileManager.default.removeItem(atPath: fullPath(identifier))
}
/// Returns the filesystem path to the item in the repo
/// Non-filesystem Repo sublcasses should implement this but return nil
func pathFor(_ identifier: String) -> String? {
return fullPath(identifier)
}
}