@@ -148,6 +148,7 @@ public enum FileMode: Sendable {
148
148
/// - Note: All of these APIs are synchronous and can block.
149
149
public protocol FileSystem : Sendable {
150
150
/// Check whether the given path exists and is accessible.
151
+ @_disfavoredOverload
151
152
func exists( _ path: AbsolutePath , followSymlink: Bool ) -> Bool
152
153
153
154
/// Check whether the given path is accessible and a directory.
@@ -183,6 +184,7 @@ public protocol FileSystem: Sendable {
183
184
/// The current working directory can be empty if e.g. the directory became
184
185
/// unavailable while the current process was still working in it.
185
186
/// This follows the POSIX `getcwd(3)` semantics.
187
+ @_disfavoredOverload
186
188
var currentWorkingDirectory : AbsolutePath ? { get }
187
189
188
190
/// Change the current working directory.
@@ -191,12 +193,15 @@ public protocol FileSystem: Sendable {
191
193
func changeCurrentWorkingDirectory( to path: AbsolutePath ) throws
192
194
193
195
/// Get the home directory of current user
196
+ @_disfavoredOverload
194
197
var homeDirectory : AbsolutePath { get throws }
195
198
196
199
/// Get the caches directory of current user
200
+ @_disfavoredOverload
197
201
var cachesDirectory : AbsolutePath ? { get }
198
202
199
203
/// Get the temp directory
204
+ @_disfavoredOverload
200
205
var tempDirectory : AbsolutePath { get throws }
201
206
202
207
/// Create the given directory.
@@ -219,16 +224,19 @@ public protocol FileSystem: Sendable {
219
224
/// Get the contents of a file.
220
225
///
221
226
/// - Returns: The file contents as bytes, or nil if missing.
227
+ @_disfavoredOverload
222
228
func readFileContents( _ path: AbsolutePath ) throws -> ByteString
223
229
224
230
// FIXME: This is obviously not a very efficient or flexible API.
225
231
//
226
232
/// Write the contents of a file.
233
+ @_disfavoredOverload
227
234
func writeFileContents( _ path: AbsolutePath , bytes: ByteString ) throws
228
235
229
236
// FIXME: This is obviously not a very efficient or flexible API.
230
237
//
231
238
/// Write the contents of a file.
239
+ @_disfavoredOverload
232
240
func writeFileContents( _ path: AbsolutePath , bytes: ByteString , atomically: Bool ) throws
233
241
234
242
/// Recursively deletes the file system entity at `path`.
@@ -259,6 +267,7 @@ public protocol FileSystem: Sendable {
259
267
/// methods).
260
268
public extension FileSystem {
261
269
/// exists override with default value.
270
+ @_disfavoredOverload
262
271
func exists( _ path: AbsolutePath ) -> Bool {
263
272
return exists ( path, followSymlink: true )
264
273
}
@@ -275,6 +284,7 @@ public extension FileSystem {
275
284
276
285
// Unless the file system type provides an override for this method, throw
277
286
// if `atomically` is `true`, otherwise fall back to whatever implementation already exists.
287
+ @_disfavoredOverload
278
288
func writeFileContents( _ path: AbsolutePath , bytes: ByteString , atomically: Bool ) throws {
279
289
guard !atomically else {
280
290
throw FileSystemError ( . unsupported, path)
@@ -283,6 +293,7 @@ public extension FileSystem {
283
293
}
284
294
285
295
/// Write to a file from a stream producer.
296
+ @_disfavoredOverload
286
297
func writeFileContents( _ path: AbsolutePath , body: ( WritableByteStream ) -> Void ) throws {
287
298
let contents = BufferedOutputByteStream ( )
288
299
body ( contents)
0 commit comments