Revert "Fix compiler crash - make workdirectory a struct"

This reverts commit e8333f2922.
This commit is contained in:
Kare Morstol
2015-02-27 23:53:32 +01:00
parent 9e2d44682f
commit 908a8ecaae
2 changed files with 7 additions and 7 deletions
+3 -3
View File
@@ -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)")
}
+4 -4
View File
@@ -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" )
}
}