Use SystemPath for PluginConfig#23
Open
chrisgeo wants to merge 1 commit into
Open
Conversation
83e1062 to
07c10a8
Compare
Convert PluginConfig.init from URL to FilePath, following the migration pattern from apple#1480 (HostDNSResolver), apple#1518 (PacketFilter), and discussion apple#1481. - PluginConfig.init?(configURL: URL) → init?(configPath: FilePath) - DefaultPluginFactory.findConfigURL → findConfigPath (returns FilePath?) - Both internal call sites (DefaultPluginFactory, AppBundlePluginFactory) updated; bridge from URL to FilePath stays at the directory boundary since broader PluginFactory conversion is tracked separately. - Tests updated to derive FilePath from temp URL.
07c10a8 to
3bdfaab
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Converts
PluginConfig.initfromURLtoSystemPackage.FilePath, following the established migration pattern (apple#1480, apple#1518).Changes
PluginConfig.init?(configURL: URL) throws→init?(configPath: FilePath) throwsDefaultPluginFactory.findConfigURL→findConfigPath(return typeURL?→FilePath?)configPath.extension(FilePath,String?) replacesconfigURL.pathExtensionOptional handling
FilePath.extensionreturnsString?whileURL.pathExtensionreturnsString. Theswitch configPath.extensionarms (case "toml",case "json") only match the non-nil cases; nil falls through todefault: return nil. Safe by construction — and the nil case is unreachable in practice sincefindConfigPathonly returns paths forconfig.tomlorconfig.json.Out of scope (deliberately)
findConfigPathstill takesdirectory: URL(notFilePath). The directory comes fromFileManager.contentsOfDirectorywhich producesURL, and broaderPluginFactoryconversion is tracked separately as CHAOS-1464. The bridge from URL → FilePath happens at the return point only.Plugin.binaryURL: URLandPlugin.resourceURL: URL?unchanged — they're passed directly toProcess.executableURL(Foundation requires URL).Wire format
PluginConfigisCodablebut is only ever decoded from on-disk TOML/JSON config files (read-only).Plugin(which embedsPluginConfig) is encoded for XPC, butPlugin's stored properties are unchanged by this PR. No wire-format break.Context
Test plan
swift test --filter PluginConfigTest— 4/4 tests passswift test --filter ContainerPluginTests— 28/28 tests pass (5 suites)