Vapor Documentation Beta

Structure Directory​Configuration

public struct DirectoryConfiguration

DirectoryConfiguration represents a configured working directory. It can also be used to derive a working directory automatically.

let dirConfig = DirectoryConfiguration.detect()
print(dirConfig.workingDirectory) // "/path/to/workdir"

Initializers

init(working​Directory:​)

public init(workingDirectory: String)

Create a new DirectoryConfig with a custom working directory.

Parameters

working​Directory String

Custom working directory path.

Properties

working​Directory

var workingDirectory: String

Path to the current working directory.

resources​Directory

var resourcesDirectory: String

views​Directory

var viewsDirectory: String

public​Directory

var publicDirectory: String

Methods

detect()

public static func detect() -> DirectoryConfiguration

Creates a DirectoryConfig by deriving a working directory using the #file variable or getcwd method.

Returns

The derived DirectoryConfig if it could be created, otherwise just "./".