File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ //===---------- PathExtensions.swift - Driver Testing Extensions ----------===//
2
+ //
3
+ // This source file is part of the Swift.org open source project
4
+ //
5
+ // Copyright (c) 2020 Apple Inc. and the Swift project authors
6
+ // Licensed under Apache License v2.0 with Runtime Library Exception
7
+ //
8
+ // See https://swift.org/LICENSE.txt for license information
9
+ // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10
+ //
11
+ //===----------------------------------------------------------------------===//
12
+
13
+ import Foundation
14
+ import TSCBasic
15
+
16
+ extension String {
17
+ public func escaped( ) -> Self {
18
+ #if os(Windows)
19
+ return self . replacingOccurrences ( of: " \\ " , with: " \\ \\ " )
20
+ #else
21
+ return self
22
+ #endif
23
+ }
24
+
25
+ public func nativePathString( ) -> Self {
26
+ return URL ( fileURLWithPath: self ) . withUnsafeFileSystemRepresentation {
27
+ String ( cString: $0!)
28
+ }
29
+ }
30
+ }
You can’t perform that action at this time.
0 commit comments