Skip to content

Commit 4408b6f

Browse files
committed
[feat]: file name with suffix
1 parent c35a1c8 commit 4408b6f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Sources/ScriptToolkit/FileExtension.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ import SwiftShell
1111

1212
public extension File {
1313

14+
public func nameWithSuffix(_ suffix: String) -> String {
15+
if let unwrappedExtension = `extension` {
16+
return nameExcludingExtension + suffix + "." + unwrappedExtension
17+
}
18+
else {
19+
return nameExcludingExtension + suffix
20+
}
21+
}
22+
1423
////////////////////////////////////////////////////////////////////////////////
1524
// MARK: - Duplication
1625

0 commit comments

Comments
 (0)