Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ let package = Package(
dependencies: [
.product(name: "Logging", package: "swift-log"),
.product(name: "ContainerizationOS", package: "containerization"),
"ContainerVersion",
]
),
.testTarget(
Expand Down
6 changes: 2 additions & 4 deletions Sources/ContainerPersistence/DefaultsStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ public enum DefaultsStore {
}

public static func get(key: DefaultsStore.Keys) -> String {
let executableURL = URL(fileURLWithPath: CommandLine.arguments[0]).resolvingSymlinksInPath()
let appBundle = Bundle.appBundle(executableURL: executableURL)
let appBundle = Bundle.appBundle(executableURL: CommandLine.executablePathUrl)
return udSuite.string(forKey: key.rawValue)
?? appBundle?.infoDictionary?["\(Self.userDefaultDomain).\(key.rawValue)"] as? String
?? key.defaultValue
Expand All @@ -61,8 +60,7 @@ public enum DefaultsStore {
if udSuite.object(forKey: key.rawValue) != nil {
return udSuite.bool(forKey: key.rawValue)
}
let executableURL = URL(fileURLWithPath: CommandLine.arguments[0]).resolvingSymlinksInPath()
let appBundle = Bundle.appBundle(executableURL: executableURL)
let appBundle = Bundle.appBundle(executableURL: CommandLine.executablePathUrl)
return appBundle?.infoDictionary?["\(Self.userDefaultDomain).\(key.rawValue)"] as? Bool
?? Bool(key.defaultValue)
}
Expand Down
1 change: 1 addition & 0 deletions Sources/ContainerPlugin/InstallRoot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// limitations under the License.
//===----------------------------------------------------------------------===//

import ContainerVersion
import Foundation

/// Provides the application installation root path.
Expand Down
3 changes: 2 additions & 1 deletion Sources/ContainerVersion/Bundle+AppBundle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import Foundation
/// Retrieve the application bundle for a path that refers to a macOS executable.
extension Bundle {
public static func appBundle(executableURL: URL) -> Bundle? {
let macOSURL = executableURL.deletingLastPathComponent()
let resolvedURL = executableURL.resolvingSymlinksInPath()
let macOSURL = resolvedURL.deletingLastPathComponent()
let contentsURL = macOSURL.deletingLastPathComponent()
let bundleURL = contentsURL.deletingLastPathComponent()
if bundleURL.pathExtension == "app" {
Expand Down
3 changes: 1 addition & 2 deletions Sources/ContainerVersion/ReleaseVersion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ public struct ReleaseVersion {
}

public static func version() -> String {
let executableURL = URL(fileURLWithPath: CommandLine.arguments[0]).resolvingSymlinksInPath()
let appBundle = Bundle.appBundle(executableURL: executableURL)
let appBundle = Bundle.appBundle(executableURL: CommandLine.executablePathUrl)
let bundleVersion = appBundle?.infoDictionary?["CFBundleShortVersionString"] as? String
return bundleVersion ?? get_release_version().map { String(cString: $0) } ?? "0.0.0"
}
Expand Down