Skip to content

Commit 78feb0a

Browse files
committed
cleanup
1 parent 7579380 commit 78feb0a

File tree

4 files changed

+2
-367
lines changed

4 files changed

+2
-367
lines changed

Sources/TSCBasic/Path.swift

+1-61
Original file line numberDiff line numberDiff line change
@@ -240,33 +240,6 @@ public struct RelativePath: Hashable, Sendable {
240240
_impl = impl
241241
}
242242

243-
/// Private initializer for constructing a relative path without performing
244-
/// normalization or canonicalization. This will construct a path without
245-
/// an anchor and thus may be invalid.
246-
///
247-
/*
248-
fileprivate init(unsafeUncheckedPath string: String) {
249-
self.init(PathImpl(string: string))
250-
}*/
251-
252-
/// Initializes the RelativePath from `str`, which must be a relative path
253-
/// (which means that it must not begin with a path separator or a tilde).
254-
/// An empty input path is allowed, but will be normalized to a single `.`
255-
/// character. The input string will be normalized if needed, as described
256-
/// in the documentation for RelativePath.
257-
/*public init(_ string: String) {
258-
// Normalize the relative string and store it as our Path.
259-
self.init(PathImpl(normalizingRelativePath: string))
260-
}*/
261-
262-
/*
263-
public init(static path: StaticString) {
264-
let pathString = path.withUTF8Buffer {
265-
String(decoding: $0, as: UTF8.self)
266-
}
267-
try! self.init(validating: pathString)
268-
}*/
269-
270243
/// Convenience initializer that verifies that the path is relative.
271244
public init(validating path: String) throws {
272245
try self.init(PathImpl(validatingRelativePath: path))
@@ -441,12 +414,6 @@ protocol Path: Hashable {
441414
/// Creates a path from its normalized string representation.
442415
init(string: String)
443416

444-
/// Creates a path from an absolute string representation and normalizes it.
445-
//init(normalizingAbsolutePath: String)
446-
447-
/// Creates a path from an relative string representation and normalizes it.
448-
//init(normalizingRelativePath: String)
449-
450417
/// Creates a path from a string representation, validates that it is a valid absolute path and normalizes it.
451418
init(validatingAbsolutePath: String) throws
452419

@@ -539,33 +506,6 @@ private struct WindowsPath: Path, Sendable {
539506
self.string = string
540507
}
541508

542-
/*
543-
init(normalizingAbsolutePath path: String) {
544-
let normalized: UnsafePointer<Int8> = path.fileSystemRepresentation
545-
defer { normalized.deallocate() }
546-
547-
self.init(string: String(cString: normalized)
548-
.withCString(encodedAs: UTF16.self) { pwszPath in
549-
var canonical: PWSTR!
550-
_ = PathAllocCanonicalize(pwszPath,
551-
ULONG(PATHCCH_ALLOW_LONG_PATHS.rawValue),
552-
&canonical)
553-
return String(decodingCString: canonical, as: UTF16.self)
554-
})
555-
}
556-
557-
init(normalizingRelativePath path: String) {
558-
if path.isEmpty || path == "." {
559-
self.init(string: ".")
560-
} else {
561-
var buffer: [WCHAR] = Array<WCHAR>(repeating: 0, count: Int(MAX_PATH + 1))
562-
_ = path.replacingOccurrences(of: "/", with: "\\").withCString(encodedAs: UTF16.self) {
563-
PathCanonicalizeW(&buffer, $0)
564-
}
565-
self.init(string: String(decodingCString: buffer, as: UTF16.self))
566-
}
567-
}*/
568-
569509
init(validatingAbsolutePath path: String) throws {
570510
let fsr: UnsafePointer<Int8> = path.fileSystemRepresentation
571511
defer { fsr.deallocate() }
@@ -842,7 +782,7 @@ private struct UNIXPath: Path, Sendable {
842782

843783
init(validatingRelativePath path: String) throws {
844784
switch path.first {
845-
case "/": //, "~":
785+
case "/":
846786
throw PathValidationError.invalidRelativePath(path)
847787
default:
848788
self.init(normalizingRelativePath: path)

Sources/TSCTestSupport/FileSystemExtensions.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ extension AbsolutePath {
8282
try! self.init(validating: pathString)
8383
}
8484

85-
@available(*, deprecated, message: "use init(static: relativeTo:) instead")
85+
@available(*, deprecated, message: "use init(: relativeTo:) instead")
8686
public init(path: StaticString, relativeTo basePath: AbsolutePath) {
8787
let pathString = path.withUTF8Buffer {
8888
String(decoding: $0, as: UTF8.self)

debug

-1
This file was deleted.

0 commit comments

Comments
 (0)