Skip to content

Commit 82640e6

Browse files
authored
Merge pull request #74 from mxcl/ci/5.5
ci/5.5
2 parents bb449ff + f49e5c8 commit 82640e6

File tree

3 files changed

+43
-20
lines changed

3 files changed

+43
-20
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,13 @@ jobs:
5454
strategy:
5555
matrix:
5656
swift:
57-
- '5.1'
58-
- '5.2'
59-
- '5.3'
60-
- '5.4'
57+
- swift:5.1
58+
- swift:5.2
59+
- swift:5.3
60+
- swift:5.4
61+
- swiftlang/swift:nightly-5.5
6162
container:
62-
image: swift:${{ matrix.swift }}
63+
image: ${{ matrix.swift }}
6364
steps:
6465
- uses: actions/checkout@v2
6566
- run: useradd -ms /bin/bash mxcl

Sources/Path+CommonDirectories.swift

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import Foundation
22

33
/// The `extension` that provides static properties that are common directories.
4-
extension Path {
4+
private enum Foo {
55
//MARK: Common Directories
66

77
/// Returns a `Path` containing `FileManager.default.currentDirectoryPath`.
8-
public static var cwd: DynamicPath {
8+
static var cwd: DynamicPath {
99
return .init(string: FileManager.default.currentDirectoryPath)
1010
}
1111

1212
/// Returns a `Path` representing the root path.
13-
public static var root: DynamicPath {
13+
static var root: DynamicPath {
1414
return .init(string: "/")
1515
}
1616

@@ -27,7 +27,7 @@ extension Path {
2727
#endif
2828

2929
/// Returns a `Path` representing the user’s home directory
30-
public static var home: DynamicPath {
30+
static var home: DynamicPath {
3131
let string: String
3232
#if os(macOS)
3333
if #available(OSX 10.12, *) {
@@ -70,7 +70,7 @@ extension Path {
7070
- Note: There is no standard location for documents on Linux, thus we return `~/Documents`.
7171
- Note: You should create a subdirectory before creating any files.
7272
*/
73-
public static var documents: DynamicPath {
73+
static var documents: DynamicPath {
7474
return path(for: .documentDirectory)
7575
}
7676

@@ -79,7 +79,7 @@ extension Path {
7979
- Note: On Linux this is `XDG_CACHE_HOME`.
8080
- Note: You should create a subdirectory before creating any files.
8181
*/
82-
public static var caches: DynamicPath {
82+
static var caches: DynamicPath {
8383
return path(for: .cachesDirectory)
8484
}
8585

@@ -88,7 +88,7 @@ extension Path {
8888
- Note: On Linux is `XDG_DATA_HOME`.
8989
- Note: You should create a subdirectory before creating any files.
9090
*/
91-
public static var applicationSupport: DynamicPath {
91+
static var applicationSupport: DynamicPath {
9292
return path(for: .applicationSupportDirectory)
9393
}
9494
}
@@ -108,13 +108,35 @@ func defaultUrl(for searchPath: FileManager.SearchPathDirectory) -> DynamicPath
108108
}
109109
#endif
110110

111+
/// The `extension` that provides static properties that are common directories.
111112
#if swift(>=5.5)
112-
extension Pathish where Self == Path {
113-
static var home: DynamicPath { Path.home }
114-
static var root: DynamicPath { Path.root }
115-
static var cwd: DynamicPath { Path.cwd }
116-
static var documents: DynamicPath { Path.documents }
117-
static var caches: DynamicPath { Path.caches }
118-
static var applicationSupport: DynamicPath { Path.applicationSupport }
113+
public extension Pathish where Self == Path {
114+
static var home: DynamicPath { return Foo.home }
115+
static var root: DynamicPath { return Foo.root }
116+
static var cwd: DynamicPath { return Foo.cwd }
117+
static var documents: DynamicPath { return Foo.documents }
118+
static var caches: DynamicPath { return Foo.caches }
119+
static var applicationSupport: DynamicPath { return Foo.applicationSupport }
120+
static func source(for filePath: String = #filePath) -> (file: DynamicPath, directory: DynamicPath) {
121+
return Foo.source(for: filePath)
122+
}
123+
}
124+
#else
125+
public extension Path {
126+
static var home: DynamicPath { return Foo.home }
127+
static var root: DynamicPath { return Foo.root }
128+
static var cwd: DynamicPath { return Foo.cwd }
129+
static var documents: DynamicPath { return Foo.documents }
130+
static var caches: DynamicPath { return Foo.caches }
131+
static var applicationSupport: DynamicPath { return Foo.applicationSupport }
132+
#if swift(>=5.3)
133+
static func source(for filePath: String = #filePath) -> (file: DynamicPath, directory: DynamicPath) {
134+
return Foo.source(for: filePath)
135+
}
136+
#else
137+
static func source(for file: String = #file) -> (file: DynamicPath, directory: DynamicPath) {
138+
return Foo.source(for: file)
139+
}
140+
#endif
119141
}
120142
#endif

Sources/Path+ls.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,6 @@ public extension Array where Element == Path {
198198

199199
/// Options for `Path.ls(_:)`
200200
public enum ListDirectoryOptions {
201-
/// Creates intermediary directories; works the same as `mkdir -p`.
201+
/// Lists hidden files also
202202
case a
203203
}

0 commit comments

Comments
 (0)