From e8111f0a3d150e3ff3f57cb7ecd36ea81ef60793 Mon Sep 17 00:00:00 2001 From: Greg Neagle Date: Fri, 13 Sep 2024 18:46:49 -0700 Subject: [PATCH] New Repo method optionally return the filesystem path to an item. --- code/cli/munki/iconimporter/iconimporter.swift | 11 +++++++++++ code/cli/munki/shared/munkirepo/FileRepo.swift | 7 +++++++ 2 files changed, 18 insertions(+) create mode 100644 code/cli/munki/iconimporter/iconimporter.swift diff --git a/code/cli/munki/iconimporter/iconimporter.swift b/code/cli/munki/iconimporter/iconimporter.swift new file mode 100644 index 00000000..1b9a3cfa --- /dev/null +++ b/code/cli/munki/iconimporter/iconimporter.swift @@ -0,0 +1,11 @@ +// +// main.swift +// iconimporter +// +// Created by Greg Neagle on 9/13/24. +// + +import Foundation + +print("Hello, World!") + diff --git a/code/cli/munki/shared/munkirepo/FileRepo.swift b/code/cli/munki/shared/munkirepo/FileRepo.swift index 9e495da4..dc76bd2c 100644 --- a/code/cli/munki/shared/munkirepo/FileRepo.swift +++ b/code/cli/munki/shared/munkirepo/FileRepo.swift @@ -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) + } }