1+ import _NIOFileSystem
12import Foundation
23import Glob
34import Logging
45import NIOCore
5- import NIOFileSystem
66import Path
77import ZIPFoundation
88
@@ -340,12 +340,12 @@ public struct FileSystem: FileSysteming, Sendable {
340340 }
341341
342342 public func currentWorkingDirectory( ) async throws -> AbsolutePath {
343- try await NIOFileSystem . FileSystem. shared. currentWorkingDirectory. path
343+ try await _NIOFileSystem . FileSystem. shared. currentWorkingDirectory. path
344344 }
345345
346346 public func exists( _ path: AbsolutePath ) async throws -> Bool {
347347 logger? . debug ( " Checking if a file or directory exists at path \( path. pathString) . " )
348- let info = try await NIOFileSystem . FileSystem. shared. info ( forFileAt: . init( path. pathString) )
348+ let info = try await _NIOFileSystem . FileSystem. shared. info ( forFileAt: . init( path. pathString) )
349349 return info != nil
350350 }
351351
@@ -355,15 +355,15 @@ public struct FileSystem: FileSysteming, Sendable {
355355 } else {
356356 logger? . debug ( " Checking if a file exists at path \( path. pathString) . " )
357357 }
358- guard let info = try await NIOFileSystem . FileSystem. shared. info ( forFileAt: . init( path. pathString) ) else {
358+ guard let info = try await _NIOFileSystem . FileSystem. shared. info ( forFileAt: . init( path. pathString) ) else {
359359 return false
360360 }
361361 return info. type == ( isDirectory ? . directory : . regular)
362362 }
363363
364364 public func touch( _ path: Path . AbsolutePath ) async throws {
365365 logger? . debug ( " Touching a file at path \( path. pathString) . " )
366- _ = try await NIOFileSystem . FileSystem. shared. withFileHandle ( forWritingAt: . init( path. pathString) ) { writer in
366+ _ = try await _NIOFileSystem . FileSystem. shared. withFileHandle ( forWritingAt: . init( path. pathString) ) { writer in
367367 try await writer. write ( contentsOf: " " . data ( using: . utf8) !, toAbsoluteOffset: 0 )
368368 }
369369 }
@@ -416,8 +416,8 @@ public struct FileSystem: FileSysteming, Sendable {
416416 try ? await makeDirectory ( at: to. parentDirectory, options: [ . createTargetParentDirectories] )
417417 }
418418 }
419- try await NIOFileSystem . FileSystem. shared. moveItem ( at: . init( from. pathString) , to: . init( to. pathString) )
420- } catch let error as NIOFileSystem . FileSystemError {
419+ try await _NIOFileSystem . FileSystem. shared. moveItem ( at: . init( from. pathString) , to: . init( to. pathString) )
420+ } catch let error as _NIOFileSystem . FileSystemError {
421421 if error. code == . notFound {
422422 throw FileSystemError . moveNotFound ( from: from, to: to)
423423 } else {
@@ -440,12 +440,12 @@ public struct FileSystem: FileSysteming, Sendable {
440440 logger? . debug ( " Creating directory at path \( at. pathString) . " )
441441 }
442442 do {
443- try await NIOFileSystem . FileSystem. shared. createDirectory (
443+ try await _NIOFileSystem . FileSystem. shared. createDirectory (
444444 at: . init( at. pathString) ,
445445 withIntermediateDirectories: options
446446 . contains ( . createTargetParentDirectories)
447447 )
448- } catch let error as NIOFileSystem . FileSystemError {
448+ } catch let error as _NIOFileSystem . FileSystemError {
449449 if error. code == . invalidArgument {
450450 throw FileSystemError . makeDirectoryAbsentParent ( at)
451451 } else {
@@ -462,7 +462,7 @@ public struct FileSystem: FileSysteming, Sendable {
462462 if log {
463463 logger? . debug ( " Reading file at path \( path. pathString) . " )
464464 }
465- let handle = try await NIOFileSystem . FileSystem. shared. openFile ( forReadingAt: . init( path. pathString) , options: . init( ) )
465+ let handle = try await _NIOFileSystem . FileSystem. shared. openFile ( forReadingAt: . init( path. pathString) , options: . init( ) )
466466
467467 let result : Result < Data , Error >
468468 do {
@@ -518,7 +518,7 @@ public struct FileSystem: FileSysteming, Sendable {
518518 try await remove ( path)
519519 }
520520
521- _ = try await NIOFileSystem . FileSystem. shared. withFileHandle ( forWritingAt: . init( path. pathString) ) { handler in
521+ _ = try await _NIOFileSystem . FileSystem. shared. withFileHandle ( forWritingAt: . init( path. pathString) ) { handler in
522522 try await handler. write ( contentsOf: data, toAbsoluteOffset: 0 )
523523 }
524524 }
@@ -554,7 +554,7 @@ public struct FileSystem: FileSysteming, Sendable {
554554 }
555555
556556 let json = try encoder. encode ( item)
557- _ = try await NIOFileSystem . FileSystem. shared. withFileHandle ( forWritingAt: . init( path. pathString) ) { handler in
557+ _ = try await _NIOFileSystem . FileSystem. shared. withFileHandle ( forWritingAt: . init( path. pathString) ) { handler in
558558 try await handler. write ( contentsOf: json, toAbsoluteOffset: 0 )
559559 }
560560 }
@@ -590,7 +590,7 @@ public struct FileSystem: FileSysteming, Sendable {
590590 try await remove ( path)
591591 }
592592
593- _ = try await NIOFileSystem . FileSystem. shared. withFileHandle ( forWritingAt: . init( path. pathString) ) { handler in
593+ _ = try await _NIOFileSystem . FileSystem. shared. withFileHandle ( forWritingAt: . init( path. pathString) ) { handler in
594594 try await handler. write ( contentsOf: json, toAbsoluteOffset: 0 )
595595 }
596596 }
@@ -603,7 +603,7 @@ public struct FileSystem: FileSysteming, Sendable {
603603 if !( try await exists ( to. parentDirectory) ) {
604604 try await makeDirectory ( at: to. parentDirectory)
605605 }
606- try await NIOFileSystem . FileSystem. shared. replaceItem ( at: . init( to. pathString) , withItemAt: . init( path. pathString) )
606+ try await _NIOFileSystem . FileSystem. shared. replaceItem ( at: . init( to. pathString) , withItemAt: . init( path. pathString) )
607607 }
608608
609609 public func copy( _ from: AbsolutePath, to: AbsolutePath) async throws {
@@ -614,7 +614,7 @@ public struct FileSystem: FileSysteming, Sendable {
614614 if !( try await exists ( to. parentDirectory) ) {
615615 try await makeDirectory ( at: to. parentDirectory)
616616 }
617- try await NIOFileSystem . FileSystem. shared. copyItem ( at: . init( from. pathString) , to: . init( to. pathString) )
617+ try await _NIOFileSystem . FileSystem. shared. copyItem ( at: . init( from. pathString) , to: . init( to. pathString) )
618618 }
619619
620620 public func runInTemporaryDirectory< T> (
@@ -646,7 +646,7 @@ public struct FileSystem: FileSysteming, Sendable {
646646 )
647647 public func fileSizeInBytes( at path: AbsolutePath) async throws -> Int64 ? {
648648 logger? . debug ( " Getting the size in bytes of file at path \( path. pathString) . " )
649- guard let info = try await NIOFileSystem . FileSystem. shared. info (
649+ guard let info = try await _NIOFileSystem . FileSystem. shared. info (
650650 forFileAt: . init( path. pathString) ,
651651 infoAboutSymbolicLink: true
652652 ) else { return nil }
@@ -655,7 +655,7 @@ public struct FileSystem: FileSysteming, Sendable {
655655
656656 public func fileMetadata( at path: AbsolutePath) async throws -> FileMetadata? {
657657 logger? . debug ( " Getting the metadata of file at path \( path. pathString) . " )
658- guard let info = try await NIOFileSystem . FileSystem. shared. info (
658+ guard let info = try await _NIOFileSystem . FileSystem. shared. info (
659659 forFileAt: . init( path. pathString) ,
660660 infoAboutSymbolicLink: true
661661 ) else { return nil }
@@ -684,7 +684,7 @@ public struct FileSystem: FileSysteming, Sendable {
684684
685685 private func createSymbolicLink( fromPathString: String, toPathString: String) async throws {
686686 logger? . debug ( " Creating symbolic link from \( fromPathString) to \( toPathString) . " )
687- try await NIOFileSystem . FileSystem. shared. createSymbolicLink (
687+ try await _NIOFileSystem . FileSystem. shared. createSymbolicLink (
688688 at: FilePath ( fromPathString) ,
689689 withDestination: FilePath ( toPathString)
690690 )
@@ -695,7 +695,7 @@ public struct FileSystem: FileSysteming, Sendable {
695695 if !( try await exists ( symlinkPath) ) {
696696 throw FileSystemError . absentSymbolicLink ( symlinkPath)
697697 }
698- guard let info = try await NIOFileSystem . FileSystem. shared. info (
698+ guard let info = try await _NIOFileSystem . FileSystem. shared. info (
699699 forFileAt: FilePath ( symlinkPath. pathString) ,
700700 infoAboutSymbolicLink: true
701701 )
@@ -706,7 +706,7 @@ public struct FileSystem: FileSysteming, Sendable {
706706 default :
707707 return symlinkPath
708708 }
709- let path = try await NIOFileSystem . FileSystem. shared. destinationOfSymbolicLink ( at: FilePath ( symlinkPath. pathString) )
709+ let path = try await _NIOFileSystem . FileSystem. shared. destinationOfSymbolicLink ( at: FilePath ( symlinkPath. pathString) )
710710 if path. starts ( with: " / " ) {
711711 return try AbsolutePath ( validating: path. string)
712712 } else {
0 commit comments