Vapor Documentation

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

public var workingDirectory: String

Path to the current working directory.

resources​Directory

public var resourcesDirectory: String

views​Directory

public var viewsDirectory: String

public​Directory

public 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 "./".