saiHemak / FileKit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FileKit

Utility for resolving common paths

Build Status - Master macOS Linux Apache 2

Version Info

The latest release of FileKit (v0.x.x) runs on Swift 4.0 and newer, on both macOS and Ubuntu Linux

Installation

Via Swift Package Manager

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"))
  ]
)

Supported Paths

Path to Executable Folder

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.executableURL

Path to Project Folder

Points 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.projectFolderURL

Path to Working Directory

Provides 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

Built-in Swift File Utilities

  /// URL pointing to current file
  let stringUrl = URL(fileURLWithPath: #file)

About

License:Apache License 2.0


Languages

Language:Swift 100.0%