Skip to content

Commit 6f70d20

Browse files
fixup: Move FileDescriptor.fileSize() to an internal extension in SystemTests
1 parent c50105e commit 6f70d20

File tree

2 files changed

+25
-14
lines changed

2 files changed

+25
-14
lines changed

Sources/System/FileHelpers.swift

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -122,18 +122,4 @@ extension FileDescriptor {
122122
return .success(buffer.count)
123123
}
124124
}
125-
126-
/// Return the current size of the file.
127-
///
128-
/// - Returns: The current size of the file, in bytes.
129-
@_alwaysEmitIntoClient
130-
@discardableResult
131-
public func fileSize(
132-
retryOnInterrupt: Bool = true
133-
) throws -> Int64 {
134-
let current = try seek(offset: 0, from: .current)
135-
let size = try seek(offset: 0, from: .end)
136-
try seek(offset: current, from: .start)
137-
return size
138-
}
139125
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
This source file is part of the Swift System open source project
3+
4+
Copyright (c) 2020 Apple Inc. and the Swift System project authors
5+
Licensed under Apache License v2.0 with Runtime Library Exception
6+
7+
See https://swift.org/LICENSE.txt for license information
8+
*/
9+
10+
#if SYSTEM_PACKAGE
11+
@testable import SystemPackage
12+
#else
13+
@testable import System
14+
#endif
15+
16+
extension FileDescriptor {
17+
internal func fileSize(
18+
retryOnInterrupt: Bool = true
19+
) throws -> Int64 {
20+
let current = try seek(offset: 0, from: .current)
21+
let size = try seek(offset: 0, from: .end)
22+
try seek(offset: current, from: .start)
23+
return size
24+
}
25+
}

0 commit comments

Comments
 (0)