@@ -157,13 +157,17 @@ public struct AbsolutePath: Hashable {
157
157
/// This method should only be used in cases where the input is guaranteed
158
158
/// to be a valid path component (i.e., it cannot be empty, contain a path
159
159
/// separator, or be a pseudo-path like '.' or '..').
160
- public func appending( components names: String ... ) -> AbsolutePath {
160
+ public func appending( components names: [ String ] ) -> AbsolutePath {
161
161
// FIXME: This doesn't seem a particularly efficient way to do this.
162
162
return names. reduce ( self , { path, name in
163
163
path. appending ( component: name)
164
164
} )
165
165
}
166
166
167
+ public func appending( components names: String ... ) -> AbsolutePath {
168
+ appending ( components: names)
169
+ }
170
+
167
171
/// NOTE: We will most likely want to add other `appending()` methods, such
168
172
/// as `appending(suffix:)`, and also perhaps `replacing()` methods,
169
173
/// such as `replacing(suffix:)` or `replacing(basename:)` for some
@@ -243,6 +247,14 @@ public struct RelativePath: Hashable {
243
247
return _impl. basename
244
248
}
245
249
250
+ /// Returns the basename without the extension.
251
+ public var basenameWithoutExt : String {
252
+ if let ext = self . extension {
253
+ return String ( basename. dropLast ( ext. count + 1 ) )
254
+ }
255
+ return basename
256
+ }
257
+
246
258
/// Suffix (including leading `.` character) if any. Note that a basename
247
259
/// that starts with a `.` character is not considered a suffix, nor is a
248
260
/// trailing `.` character.
@@ -288,12 +300,16 @@ public struct RelativePath: Hashable {
288
300
/// This method should only be used in cases where the input is guaranteed
289
301
/// to be a valid path component (i.e., it cannot be empty, contain a path
290
302
/// separator, or be a pseudo-path like '.' or '..').
291
- public func appending( components names: String ... ) -> RelativePath {
303
+ public func appending( components names: [ String ] ) -> RelativePath {
292
304
// FIXME: This doesn't seem a particularly efficient way to do this.
293
305
return names. reduce ( self , { path, name in
294
306
path. appending ( component: name)
295
307
} )
296
308
}
309
+
310
+ public func appending( components names: String ... ) -> RelativePath {
311
+ appending ( components: names)
312
+ }
297
313
}
298
314
299
315
extension AbsolutePath : Codable {
0 commit comments