Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions TestFoundation/TestURL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ class TestURL : XCTestCase {
static var gBaseCurrentWorkingDirectoryPath : String {
return FileManager.default.currentDirectoryPath
}
static var gSavedPath = ""
static var gRelativeOffsetFromBaseCurrentWorkingDirectory: UInt = 0
static let gFileExistsName = "TestCFURL_file_exists\(ProcessInfo.processInfo.globallyUniqueString)"
static let gFileDoesNotExistName = "TestCFURL_file_does_not_exist"
Expand Down Expand Up @@ -339,9 +340,8 @@ class TestURL : XCTestCase {
}
}

#if os(Android)
FileManager.default.changeCurrentDirectoryPath("/data/local/tmp")
#endif
TestURL.gSavedPath = FileManager.default.currentDirectoryPath
FileManager.default.changeCurrentDirectoryPath(NSTemporaryDirectory())

let cwd = FileManager.default.currentDirectoryPath
let cwdURL = URL(fileURLWithPath: cwd, isDirectory: true)
Expand All @@ -358,6 +358,7 @@ class TestURL : XCTestCase {
let error = strerror(errno)!
XCTFail("Failed to set up test paths: \(String(cString: error))")
}
defer { FileManager.default.changeCurrentDirectoryPath(TestURL.gSavedPath) }

// test with file that exists
var path = TestURL.gFileExistsPath
Expand Down Expand Up @@ -403,6 +404,7 @@ class TestURL : XCTestCase {
let error = strerror(errno)!
XCTFail("Failed to set up test paths: \(String(cString: error))")
}
defer { FileManager.default.changeCurrentDirectoryPath(TestURL.gSavedPath) }

// test with file that exists
var path = TestURL.gFileExistsPath
Expand Down