New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SR-11089] Add a "nullDevice" extension to Foundation's FileManager #3995
Comments
Comment by Gwen Mittertreiner (JIRA) @millenomi Would this be a reasonable thing to add to Foundation? |
FileHandle already provides handles to write to the null device (via its .nullDevice property). What is your intended use? Note that in the general case we cannot add API surface to swift-corelibs-foundation that doesn’t already exist on Darwin. |
Comment by Gwen Mittertreiner (JIRA) This came up with the #if os(Windows)
XCTAssertTrue(fm.contentsEqual(atPath: "NUL", andPath: "NUL"))
#else
XCTAssertTrue(fm.contentsEqual(atPath: "/dev/null", andPath: "/dev/null"))
#endif Where it would significantly more portable to expose something like What do you mean by something already existing on Darwin? As it it already exists in the objective-c Foundation? |
Correct. It is not a goal of the project to introduce new API, because it is meant to allow source portability, and code that isn't compilable on Darwin is by definition not portable. If this is a need in the tests, perhaps the tests should have that as a utility. I don't recall the need being widespread within TestFoundation, though. |
Comment by Gwen Mittertreiner (JIRA) Alright, I'll keep this as a one off for the test(s) that need it. |
Additional Detail from JIRA
md5: a5019f0d2556bf17e09a687f42370d94
Issue Description:
Windows and Unix use different spelling of the null device (
NUL
vs/dev/null
). Rather than conveniently accepting/dev/null
as an alias to {{NUL}} on Windows, it would make more sense to have an extension to return the proper path as a URL.The text was updated successfully, but these errors were encountered: