Utility for resolving common paths
The latest release of FileKit (v0.x.x) runs on Swift 4.0 and newer, on both macOS and Ubuntu Linux
Add FileKit to your Package.swift:
let package = Package(
name: "<package-name>",
dependencies: [
// Swift 4
.package(url: "https://github.com/IBM-Swift/FileKit.git", .upToNextMajor(from: "0.0.0"))
]
)Points to the project executable folder
/// Executable Folder String
let stringUrl = FileKit.executableFolder
/// Executable Folder URL
let urlObject = FileKit.executableFolderURL
/// Executable File
let urlObject = FileKit.executableURLPoints to the directory containing the Package.swift of the project (as determined by traversing up the directory structure starting at the directory containing the executable), or if no Package.swift is found then the directory containing the executable
/// Absolute path to the project's root folder
let stringUrl = FileKit.projectFolder
/// URL to the project's root folder
let urlObject = FileKit.projectFolderURLProvides the standardized working directory, while accounting for environmental changes. When running in Xcode, this returns the directory containing the Package.swift of the project while outside returns the current working directory
/// Absolute path to the present working directory
let stringUrl = FileKit.workingDirectory
/// URL to the project's root folder
let urlObject = FileKit.workingDirectoryURL /// URL pointing to current file
let stringUrl = URL(fileURLWithPath: #file)