Skip to content

Commit c10ef55

Browse files
committed
[Foundation] Implemented rename
1 parent a3506e6 commit c10ef55

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
lines changed

Sources/Get/PackagesDirectory.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import struct PackageDescription.Version
1212
import func Utility.mkdir
13-
import func POSIX.rename
13+
import func Utility.rename
1414
import PackageType
1515
import Utility
1616

Sources/POSIX/rename.swift renamed to Sources/Utility/rename.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@
88
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
99
*/
1010

11-
import var libc.errno
12-
import func libc.rename
11+
import Foundation
1312

1413
public func rename(old: String, new: String) throws {
15-
let rv = libc.rename(old, new)
16-
guard rv == 0 else { throw SystemError.rename(errno, old: old, new: new) }
14+
try NSFileManager.`default`().moveItem(atPath: old, toPath: new)
1715
}

Tests/Functional/ClangModuleTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import struct Utility.Path
1212
import func Utility.symlink
1313
import func Utility.walk
14-
import func POSIX.rename
14+
import func Utility.rename
1515
import func Utility.mkdir
1616
import func POSIX.popen
1717
import XCTest

Tests/Functional/ValidLayoutTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import struct Utility.Path
1212
import func Utility.symlink
1313
import func Utility.walk
14-
import func POSIX.rename
14+
import func Utility.rename
1515
import func Utility.mkdir
1616
import func POSIX.popen
1717
import XCTest

0 commit comments

Comments
 (0)