Revert "Fix compiler crash - make workdirectory a struct"
This reverts commit e8333f2922.
This commit is contained in:
@@ -43,9 +43,9 @@ separate process and changing the directory there will not affect the rest of th
|
||||
|
||||
This directory is also used as the base for relative URL's.
|
||||
*/
|
||||
public struct workdirectory {
|
||||
public static func get() -> String { return File.currentDirectoryPath }
|
||||
public static func set(newValue: String) {
|
||||
public var workdirectory: String {
|
||||
get { return File.currentDirectoryPath }
|
||||
set {
|
||||
if !File.changeCurrentDirectoryPath(newValue) {
|
||||
printErrorAndExit("Could not change the working directory to \(newValue)")
|
||||
}
|
||||
|
||||
@@ -16,19 +16,19 @@ class Files_Tests: XCTestCase {
|
||||
}
|
||||
|
||||
func testWorkDirectory_IsCurrentDirectory () {
|
||||
XCTAssertEqual( workdirectory.get(), NSFileManager.defaultManager().currentDirectoryPath )
|
||||
XCTAssertEqual( workdirectory, NSFileManager.defaultManager().currentDirectoryPath )
|
||||
}
|
||||
|
||||
func testWorkDirectory_CanChange () {
|
||||
workdirectory.set("/private/tmp")
|
||||
workdirectory = "/private/tmp"
|
||||
|
||||
XCTAssertEqual( workdirectory.get(), "/private/tmp" )
|
||||
XCTAssertEqual( workdirectory, "/private/tmp" )
|
||||
XCTAssertEqual( $("pwd"), "/private/tmp" )
|
||||
}
|
||||
|
||||
func testURLConcatenationOperator () {
|
||||
XCTAssertEqual( "/directory" / "file.extension", "/directory/file.extension" )
|
||||
XCTAssertEqual( "/root" / "directory" / "file.extension", "/root/directory/file.extension" )
|
||||
XCTAssertEqual( "directory" / "file.extension", workdirectory.get() + "/directory/file.extension" )
|
||||
XCTAssertEqual( "directory" / "file.extension", workdirectory + "/directory/file.extension" )
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user