Skip to content

Commit 31edb2d

Browse files
committed
Rename deprecated attributes
1 parent 5a80967 commit 31edb2d

File tree

11 files changed

+46
-43
lines changed

11 files changed

+46
-43
lines changed

CoreFoundation/Base.subproj/CFPlatform.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ static _CFThreadSpecificKey __CFTSDIndexKey;
733733
static void *__CFThreadSpecificData;
734734
#endif
735735

736-
CF_PRIVATE void __CFTSDInitialize() {
736+
CF_PRIVATE void __CFTSDInitialize(void) {
737737
#if !TARGET_OS_WASI
738738
static dispatch_once_t once;
739739
dispatch_once(&once, ^{

CoreFoundation/Base.subproj/CFUtilities.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -1663,8 +1663,7 @@ CF_EXPORT Boolean _CFExtensionIsValidToAppend(CFStringRef extension) {
16631663

16641664

16651665
#if DEPLOYMENT_RUNTIME_SWIFT && !TARGET_OS_WASI
1666-
1667-
CFDictionaryRef __CFGetEnvironment() {
1666+
CFDictionaryRef __CFGetEnvironment(void) {
16681667
static dispatch_once_t once = 0L;
16691668
static CFMutableDictionaryRef envDict = NULL;
16701669
dispatch_once(&once, ^{
@@ -1719,7 +1718,7 @@ CFDictionaryRef __CFGetEnvironment() {
17191718
return envDict;
17201719
}
17211720

1722-
int32_t __CFGetPid() {
1721+
int32_t __CFGetPid(void) {
17231722
return getpid();
17241723
}
17251724

CoreFoundation/RunLoop.subproj/CFRunLoop.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ static CFStringRef __CFRunLoopCopyDescription(CFTypeRef cf) {
806806
return result;
807807
}
808808

809-
CF_PRIVATE void __CFRunLoopDump() { // __private_extern__ to keep the compiler from discarding it
809+
CF_PRIVATE void __CFRunLoopDump(void) { // __private_extern__ to keep the compiler from discarding it
810810
CFStringRef desc = CFCopyDescription(CFRunLoopGetCurrent());
811811
CFShow(desc);
812812
CFRelease(desc);

Foundation.xcodeproj/project.pbxproj

+6-2
Original file line numberDiff line numberDiff line change
@@ -3858,13 +3858,14 @@
38583858
GCC_WARN_UNUSED_FUNCTION = YES;
38593859
GCC_WARN_UNUSED_VARIABLE = YES;
38603860
LD_RUNPATH_SEARCH_PATHS = "$(TOOLCHAIN_DIR)/usr/lib/swift/macosx";
3861-
MACOSX_DEPLOYMENT_TARGET = 10.12;
3861+
MACOSX_DEPLOYMENT_TARGET = 10.15;
38623862
MTL_ENABLE_DEBUG_INFO = YES;
38633863
ONLY_ACTIVE_ARCH = YES;
38643864
SDKROOT = macosx;
38653865
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "FOUNDATION_XCTEST NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT DEBUG";
38663866
SWIFT_FORCE_DYNAMIC_LINK_STDLIB = YES;
38673867
SWIFT_FORCE_STATIC_LINK_STDLIB = NO;
3868+
SWIFT_VERSION = 5.0;
38683869
VERSIONING_SYSTEM = "apple-generic";
38693870
VERSION_INFO_PREFIX = "";
38703871
};
@@ -3914,13 +3915,14 @@
39143915
GCC_WARN_UNUSED_FUNCTION = YES;
39153916
GCC_WARN_UNUSED_VARIABLE = YES;
39163917
LD_RUNPATH_SEARCH_PATHS = "$(TOOLCHAIN_DIR)/usr/lib/swift/macosx";
3917-
MACOSX_DEPLOYMENT_TARGET = 10.12;
3918+
MACOSX_DEPLOYMENT_TARGET = 10.15;
39183919
MTL_ENABLE_DEBUG_INFO = NO;
39193920
SDKROOT = macosx;
39203921
SWIFT_COMPILATION_MODE = wholemodule;
39213922
SWIFT_FORCE_DYNAMIC_LINK_STDLIB = YES;
39223923
SWIFT_FORCE_STATIC_LINK_STDLIB = NO;
39233924
SWIFT_OPTIMIZATION_LEVEL = "-O";
3925+
SWIFT_VERSION = 5.0;
39243926
VERSIONING_SYSTEM = "apple-generic";
39253927
VERSION_INFO_PREFIX = "";
39263928
};
@@ -3952,6 +3954,7 @@
39523954
"@executable_path/../Frameworks",
39533955
"@loader_path/Frameworks",
39543956
);
3957+
MACOSX_DEPLOYMENT_TARGET = 10.15;
39553958
OTHER_CFLAGS = (
39563959
"-DCF_BUILDING_CF",
39573960
"-DDEPLOYMENT_RUNTIME_SWIFT",
@@ -4029,6 +4032,7 @@
40294032
"@executable_path/../Frameworks",
40304033
"@loader_path/Frameworks",
40314034
);
4035+
MACOSX_DEPLOYMENT_TARGET = 10.15;
40324036
OTHER_CFLAGS = (
40334037
"-DCF_BUILDING_CF",
40344038
"-DDEPLOYMENT_RUNTIME_SWIFT",

Sources/Foundation/Process.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ open class Process: NSObject {
663663
CFSocketCreateRunLoopSource(kCFAllocatorDefault, socket, 0)
664664
CFRunLoopAddSource(managerThreadRunLoop?._cfRunLoop, source, kCFRunLoopDefaultMode)
665665

666-
let workingDirectory = currentDirectoryURL?.path ?? FileManager.default.currentDirectoryPath
666+
let workingDirectory = currentDirectoryURL?.path ?? FileManager.default.currentDirectoryURL
667667
try quoteWindowsCommandLine(command).withCString(encodedAs: UTF16.self) { wszCommandLine in
668668
try FileManager.default._fileSystemRepresentation(withPath: workingDirectory) { wszCurrentDirectory in
669669
try szEnvironment.withCString(encodedAs: UTF16.self) { wszEnvironment in
@@ -1144,7 +1144,7 @@ open class Process: NSObject {
11441144
// convenience; create and launch
11451145
open class func launchedProcess(launchPath path: String, arguments: [String]) -> Process {
11461146
let process = Process()
1147-
process.launchPath = path
1147+
process.executableURL = URL(fileURLWithPath:path)
11481148
process.arguments = arguments
11491149
process.launch()
11501150

Sources/FoundationNetworking/HTTPCookieStorage.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ open class HTTPCookieStorage: NSObject {
116116
}
117117
//if we were unable to create the desired directory, create the cookie file
118118
//in a subFolder (named after the bundle) of the `pwd`
119-
return FileManager.default.currentDirectoryPath + "/" + bundleName + fileName
119+
return FileManager.default.currentDirectoryURL + "/" + bundleName + fileName
120120
}
121121

122122
// `URLSessionConfiguration.ephemeral` needs an ephemeral cookie storage.

Tests/Foundation/Tests/TestFileManager.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class TestFileManager : XCTestCase {
112112

113113
func test_creatingDirectoryWithShortIntermediatePath() {
114114
let fileManager = FileManager.default
115-
let cwd = fileManager.currentDirectoryPath
115+
let cwd = fileManager.currentDirectoryURL
116116
fileManager.changeCurrentDirectoryPath(NSTemporaryDirectory())
117117

118118
let relativePath = NSUUID().uuidString
@@ -1600,7 +1600,7 @@ VIDEOS=StopgapVideos
16001600
XCTAssertEqual(fm.string(withFileSystemRepresentation: UnsafePointer(bitPattern: 1)!, length: 0), "")
16011601

16021602
XCTAssertFalse(fm.changeCurrentDirectoryPath(""))
1603-
XCTAssertNotEqual(fm.currentDirectoryPath, "")
1603+
XCTAssertNotEqual(fm.currentDirectoryURL, "")
16041604

16051605
// Not Implemented - XCTAssertNil(fm.componentsToDisplay(forPath: ""))
16061606
// Not Implemented - XCTAssertEqual(fm.displayName(atPath: ""), "")
@@ -1881,7 +1881,7 @@ VIDEOS=StopgapVideos
18811881
} catch {
18821882
XCTFail()
18831883
}
1884-
let originalWorkingDirectory = fm.currentDirectoryPath
1884+
let originalWorkingDirectory = fm.currentDirectoryURL
18851885
defer {
18861886
fm.changeCurrentDirectoryPath(originalWorkingDirectory)
18871887
}

Tests/Foundation/Tests/TestProcess.swift

+24-24
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ class TestProcess : XCTestCase {
1616
process.executableURL = executableURL
1717
} else {
1818
// Fallback on earlier versions
19-
process.launchPath = executableURL.path
19+
process.executableURL = executableURL.path
2020
}
21-
XCTAssertEqual(executableURL.path, process.launchPath)
21+
XCTAssertEqual(executableURL.path, process.executableURL)
2222
process.arguments = ["--exit", "0"]
2323
try process.run()
2424
process.waitUntilExit()
@@ -123,7 +123,7 @@ class TestProcess : XCTestCase {
123123
return
124124
}
125125

126-
XCTAssertEqual(string.trimmingCharacters(in: CharacterSet(["\n", "\r"])), FileManager.default.currentDirectoryPath)
126+
XCTAssertEqual(string.trimmingCharacters(in: CharacterSet(["\n", "\r"])), FileManager.default.currentDirectoryURL)
127127
}
128128

129129
func test_pipe_stderr() throws {
@@ -208,7 +208,7 @@ class TestProcess : XCTestCase {
208208
XCTFail("Could not read stdout")
209209
return
210210
}
211-
XCTAssertEqual(string.trimmingCharacters(in: CharacterSet(["\r", "\n"])), FileManager.default.currentDirectoryPath)
211+
XCTAssertEqual(string.trimmingCharacters(in: CharacterSet(["\r", "\n"])), FileManager.default.currentDirectoryURL)
212212
}
213213

214214
func test_passthrough_environment() {
@@ -260,7 +260,7 @@ class TestProcess : XCTestCase {
260260
func test_current_working_directory() throws {
261261
let tmpDir = { () -> String in
262262
// NSTemporaryDirectory might return a final slash, but
263-
// FileManager.currentDirectoryPath seems to avoid it.
263+
// FileManager.currentDirectoryURL seems to avoid it.
264264
var dir = NSTemporaryDirectory()
265265
if (dir.hasSuffix("/") && dir != "/") || dir.hasSuffix("\\") {
266266
dir.removeLast()
@@ -269,7 +269,7 @@ class TestProcess : XCTestCase {
269269
}()
270270

271271
let fm = FileManager.default
272-
let previousWorkingDirectory = fm.currentDirectoryPath
272+
let previousWorkingDirectory = fm.currentDirectoryURL
273273
XCTAssertNotEqual(previousWorkingDirectory.standardizePath(), tmpDir)
274274

275275
// Test that getcwd() returns the currentDirectoryPath
@@ -285,7 +285,7 @@ class TestProcess : XCTestCase {
285285
do {
286286
let (pwd, _) = try runTask([xdgTestHelperURL().path, "--echo-PWD"], currentDirectoryPath: tmpDir)
287287
// Check the sub-process used the correct directory
288-
let cwd = FileManager.default.currentDirectoryPath.standardizePath()
288+
let cwd = FileManager.default.currentDirectoryURL.standardizePath()
289289
XCTAssertNotEqual(cwd, tmpDir)
290290
XCTAssertNotEqual(pwd.trimmingCharacters(in: .newlines).standardizePath(), tmpDir)
291291
} catch {
@@ -314,12 +314,12 @@ class TestProcess : XCTestCase {
314314
XCTFail("Test failed: \(error)")
315315
}
316316

317-
XCTAssertEqual(previousWorkingDirectory, fm.currentDirectoryPath)
317+
XCTAssertEqual(previousWorkingDirectory, fm.currentDirectoryURL)
318318
}
319319

320320
func test_run() {
321321
let fm = FileManager.default
322-
let cwd = fm.currentDirectoryPath
322+
let cwd = fm.currentDirectoryURL
323323

324324
do {
325325
let process = try Process.run(xdgTestHelperURL(), arguments: ["--exit", "123"], terminationHandler: nil)
@@ -329,7 +329,7 @@ class TestProcess : XCTestCase {
329329
} catch {
330330
XCTFail("Cant execute \(xdgTestHelperURL().path): \(error)")
331331
}
332-
XCTAssertEqual(fm.currentDirectoryPath, cwd)
332+
XCTAssertEqual(fm.currentDirectoryURL, cwd)
333333

334334
do {
335335
// Check running the process twice throws an error.
@@ -353,7 +353,7 @@ class TestProcess : XCTestCase {
353353
process.currentDirectoryURL = URL(fileURLWithPath: "/.../_no_such_directory", isDirectory: true)
354354
XCTAssertThrowsError(try process.run())
355355
}
356-
XCTAssertEqual(fm.currentDirectoryPath, cwd)
356+
XCTAssertEqual(fm.currentDirectoryURL, cwd)
357357

358358
do {
359359
let process = Process()
@@ -362,7 +362,7 @@ class TestProcess : XCTestCase {
362362
process.currentDirectoryURL = URL(fileURLWithPath: NSTemporaryDirectory())
363363
XCTAssertThrowsError(try process.run())
364364
}
365-
XCTAssertEqual(fm.currentDirectoryPath, cwd)
365+
XCTAssertEqual(fm.currentDirectoryURL, cwd)
366366
fm.changeCurrentDirectoryPath(cwd)
367367
}
368368

@@ -599,7 +599,7 @@ class TestProcess : XCTestCase {
599599
XCTAssertNotNil(process.currentDirectoryURL)
600600

601601
// Test currentDirectoryURL cannot be set to nil even though it is a URL?
602-
let cwd = URL(fileURLWithPath: FileManager.default.currentDirectoryPath, isDirectory: true)
602+
let cwd = URL(fileURLWithPath: FileManager.default.currentDirectoryURL, isDirectory: true)
603603
process.currentDirectoryURL = nil
604604
XCTAssertNotNil(process.currentDirectoryURL)
605605
XCTAssertEqual(process.currentDirectoryURL, cwd)
@@ -609,7 +609,7 @@ class TestProcess : XCTestCase {
609609
XCTAssertEqual(aFileURL.path, "/a_file")
610610
process.currentDirectoryURL = aFileURL
611611
XCTAssertNotEqual(process.currentDirectoryURL, aFileURL)
612-
XCTAssertEqual(process.currentDirectoryPath, "/a_file")
612+
XCTAssertEqual(process.currentDirectoryURL, "/a_file")
613613
XCTAssertTrue(try XCTUnwrap(process.currentDirectoryURL).hasDirectoryPath)
614614
XCTAssertEqual(try XCTUnwrap(process.currentDirectoryURL).absoluteString, "file:///a_file/")
615615

@@ -618,15 +618,15 @@ class TestProcess : XCTestCase {
618618
XCTAssertEqual(aDirURL.path, "/a_dir")
619619
process.currentDirectoryURL = aDirURL
620620
XCTAssertEqual(process.currentDirectoryURL, aDirURL)
621-
XCTAssertEqual(process.currentDirectoryPath, "/a_dir")
621+
XCTAssertEqual(process.currentDirectoryURL, "/a_dir")
622622
XCTAssertTrue(try XCTUnwrap(process.currentDirectoryURL).hasDirectoryPath)
623623
XCTAssertEqual(try XCTUnwrap(process.currentDirectoryURL).absoluteString, "file:///a_dir/")
624624

625-
process.currentDirectoryPath = ""
626-
XCTAssertEqual(process.currentDirectoryPath, "")
625+
process.currentDirectoryURL = ""
626+
XCTAssertEqual(process.currentDirectoryURL, "")
627627
XCTAssertNil(process.currentDirectoryURL)
628628
process.currentDirectoryURL = nil
629-
XCTAssertEqual(process.currentDirectoryPath, cwd.path)
629+
XCTAssertEqual(process.currentDirectoryURL, cwd.path)
630630

631631

632632
process.executableURL = URL(fileURLWithPath: "/some_file_that_doesnt_exist", isDirectory: false)
@@ -654,8 +654,8 @@ class TestProcess : XCTestCase {
654654
// The closed thing is %CD% which is a property of the shell rather
655655
// than the environment. Simply ignore this test on Windows.
656656
#if !os(Windows)
657-
XCTAssertNotEqual("/", FileManager.default.currentDirectoryPath)
658-
XCTAssertNotEqual(FileManager.default.currentDirectoryPath, "/")
657+
XCTAssertNotEqual("/", FileManager.default.currentDirectoryURL)
658+
XCTAssertNotEqual(FileManager.default.currentDirectoryURL, "/")
659659
let (stdout, _) = try runTask([xdgTestHelperURL().path, "--echo-PWD"], currentDirectoryPath: "/")
660660
let directory = stdout.trimmingCharacters(in: CharacterSet(["\n", "\r"]))
661661
XCTAssertEqual(directory, ProcessInfo.processInfo.environment["PWD"])
@@ -667,7 +667,7 @@ class TestProcess : XCTestCase {
667667
let process = Process()
668668
process.executableURL = xdgTestHelperURL()
669669
process.arguments = [ "--getcwd" ]
670-
process.currentDirectoryPath = ""
670+
process.currentDirectoryURL = ""
671671

672672
let stdoutPipe = Pipe()
673673
process.standardOutput = stdoutPipe
@@ -688,7 +688,7 @@ class TestProcess : XCTestCase {
688688
throw Error.UnicodeDecodingError(stdoutData)
689689
}
690690
let directory = stdout.trimmingCharacters(in: CharacterSet(["\n", "\r"]))
691-
XCTAssertEqual(directory, FileManager.default.currentDirectoryPath)
691+
XCTAssertEqual(directory, FileManager.default.currentDirectoryURL)
692692
} catch {
693693
XCTFail(String(describing: error))
694694
}
@@ -800,7 +800,7 @@ class TestProcess : XCTestCase {
800800
do {
801801
let data = try XCTUnwrap(pipe3.fileHandleForReading.readToEnd())
802802
let pwd = String.init(decoding: data, as: UTF8.self).trimmingCharacters(in: CharacterSet(["\n", "\r"]))
803-
XCTAssertEqual(pwd, FileManager.default.currentDirectoryPath.standardizePath())
803+
XCTAssertEqual(pwd, FileManager.default.currentDirectoryURL.standardizePath())
804804
} catch {
805805
XCTFail("\(error)")
806806
}
@@ -971,7 +971,7 @@ internal func runTask(_ arguments: [String], environment: [String: String]? = ni
971971
let process = Process()
972972

973973
var arguments = arguments
974-
process.launchPath = arguments.removeFirst()
974+
process.executableURL = arguments.removeFirst()
975975
process.arguments = arguments
976976
// Darwin Foundation doesnt allow .environment to be set to nil although the documentation
977977
// says it is an optional. https://developer.apple.com/documentation/foundation/process/1409412-environment

Tests/Foundation/Tests/TestURL.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ class TestURL : XCTestCase {
328328

329329
static let gBaseTemporaryDirectoryPath = (NSTemporaryDirectory() as NSString).appendingPathComponent("org.swift.foundation.TestFoundation.TestURL.\(ProcessInfo.processInfo.processIdentifier)")
330330
static var gBaseCurrentWorkingDirectoryPath : String {
331-
return FileManager.default.currentDirectoryPath
331+
return FileManager.default.currentDirectoryURL
332332
}
333333
static var gSavedPath = ""
334334
static var gRelativeOffsetFromBaseCurrentWorkingDirectory: UInt = 0
@@ -384,10 +384,10 @@ class TestURL : XCTestCase {
384384
}
385385
}
386386

387-
TestURL.gSavedPath = FileManager.default.currentDirectoryPath
387+
TestURL.gSavedPath = FileManager.default.currentDirectoryURL
388388
FileManager.default.changeCurrentDirectoryPath(NSTemporaryDirectory())
389389

390-
let cwd = FileManager.default.currentDirectoryPath
390+
let cwd = FileManager.default.currentDirectoryURL
391391
let cwdURL = URL(fileURLWithPath: cwd, isDirectory: true)
392392
// 1 for path separator
393393
cwdURL.withUnsafeFileSystemRepresentation {
@@ -545,7 +545,7 @@ class TestURL : XCTestCase {
545545
try fileManager.createDirectory(at: writableTestDirectoryURL, withIntermediateDirectories: true)
546546
defer { try? fileManager.removeItem(at: writableTestDirectoryURL) }
547547

548-
let previousCurrentDirectory = fileManager.currentDirectoryPath
548+
let previousCurrentDirectory = fileManager.currentDirectoryURL
549549
fileManager.changeCurrentDirectoryPath(writableTestDirectoryURL.path)
550550
defer { fileManager.changeCurrentDirectoryPath(previousCurrentDirectory) }
551551

Tests/Tools/GenerateTestFixtures/main.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
let arguments = ProcessInfo.processInfo.arguments
5454
let outputRoot: URL
5555
if arguments.count > 1 {
56-
outputRoot = URL(fileURLWithPath: arguments[1], relativeTo: URL(fileURLWithPath: FileManager.default.currentDirectoryPath))
56+
outputRoot = URL(fileURLWithPath: arguments[1], relativeTo: URL(fileURLWithPath: FileManager.default.currentDirectoryURL))
5757
} else {
5858
outputRoot = Bundle.main.executableURL!.deletingLastPathComponent()
5959
}

Tests/Tools/XDGTestHelper/main.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ case "--xdgcheck":
226226
XDGCheck.run()
227227

228228
case "--getcwd":
229-
print(FileManager.default.currentDirectoryPath)
229+
print(FileManager.default.currentDirectoryURL)
230230

231231
case "--echo-PWD":
232232
print(ProcessInfo.processInfo.environment["PWD"] ?? "")

0 commit comments

Comments
 (0)