Skip to content

[Experimental][DNM] Use SwiftSystem for file operations#221

Draft
stevapple wants to merge 9 commits into
swiftlang:mainfrom
stevapple:filepath-fileops
Draft

[Experimental][DNM] Use SwiftSystem for file operations#221
stevapple wants to merge 9 commits into
swiftlang:mainfrom
stevapple:filepath-fileops

Conversation

@stevapple

@stevapple stevapple commented Jun 6, 2021

Copy link
Copy Markdown

This PR intends to use SwiftSystem for file operations in TSCBasic, which are currently based on TSClibc.
It is based on #219 .

This will:

  • Simplify the implementation;
  • Make the code stronger and lot more “Swifty”;
  • Potentially improve the performance.

Discussion: Do we really need a buffer for I/O?

TBD: (mostly SwiftSystem side)

  • Pipe support;
  • Lock support;
  • Better FileDescriptor to FILE bridge.

Comment thread Package.resolved
]
},
"version": 1
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove this file

default:
self.init(.unknownOSError, path)
case .permissionDenied: return .invalidAccess
case .isDirectory: return.isDirectory

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing space?

#endif
filepath.root = base.filepath.root

let commonAncestor = AbsolutePath(filepath).lowestCommonAncestor(with: base)!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

guard + precondition instead of bang?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think callers should guard such condition🤔 Breaking is quite reasonable and necessary here.

We’d better discuss in #219 since this API change is introduced there.

Comment thread Sources/TSCBasic/Path.swift
@tomerd

tomerd commented Feb 2, 2022

Copy link
Copy Markdown
Contributor

@stevapple @compnerd we now have swift-system integrated into the main branch of TSC and can start making use of it / reduce code to help support windows paths etc better

@tomerd tomerd added the wip Work in progress label Mar 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wip Work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants