Skip to content

Commit 22ead52

Browse files
committed
Fix crash in Linux
1 parent 9700bf5 commit 22ead52

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ defaults:
1414
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
1515
BUNDLE_PATH: vendor/bundle
1616
docker:
17-
- image: norionomura/jazzy:swift-4.1.2
17+
- image: norionomura/jazzy:swift-4.1.3
1818
shell: /bin/bash --login -eo pipefail
1919
- &prepare-storage
2020
run:

Sources/StencilSwiftKit/Filters+Strings.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,15 @@ extension Filters.Strings {
305305
/// - Throws: FilterError.invalidInputType if the value parameter isn't a string
306306
static func dirname(_ value: Any?) throws -> Any? {
307307
let string = try Filters.parseString(from: value)
308+
#if os(Linux)
309+
var result = NSString(string: string).deletingLastPathComponent
310+
if result.isEmpty {
311+
result = "."
312+
}
313+
return result
314+
#else
308315
return Path(string).parent().normalize().string
316+
#endif
309317
}
310318

311319
/// Removes newlines and other whitespace from a string. Takes an optional Mode argument:

0 commit comments

Comments
 (0)