@@ -240,33 +240,6 @@ public struct RelativePath: Hashable, Sendable {
240
240
_impl = impl
241
241
}
242
242
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
-
270
243
/// Convenience initializer that verifies that the path is relative.
271
244
public init ( validating path: String ) throws {
272
245
try self . init ( PathImpl ( validatingRelativePath: path) )
@@ -441,12 +414,6 @@ protocol Path: Hashable {
441
414
/// Creates a path from its normalized string representation.
442
415
init ( string: String )
443
416
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
-
450
417
/// Creates a path from a string representation, validates that it is a valid absolute path and normalizes it.
451
418
init ( validatingAbsolutePath: String ) throws
452
419
@@ -539,33 +506,6 @@ private struct WindowsPath: Path, Sendable {
539
506
self . string = string
540
507
}
541
508
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
-
569
509
init ( validatingAbsolutePath path: String ) throws {
570
510
let fsr : UnsafePointer < Int8 > = path. fileSystemRepresentation
571
511
defer { fsr. deallocate ( ) }
@@ -842,7 +782,7 @@ private struct UNIXPath: Path, Sendable {
842
782
843
783
init ( validatingRelativePath path: String ) throws {
844
784
switch path. first {
845
- case " / " : //, "~":
785
+ case " / " :
846
786
throw PathValidationError . invalidRelativePath ( path)
847
787
default :
848
788
self . init ( normalizingRelativePath: path)
0 commit comments