Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Commit

Permalink
Fix file extension (#198)
Browse files Browse the repository at this point in the history
* Fix file extension

* Rename variable
  • Loading branch information
timbaev authored and tanner0101 committed Apr 10, 2019
1 parent 02f1d0d commit 57368d4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Sources/Core/File.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ public struct File: Codable {

/// The file extension, if it has one.
public var ext: String? {
return filename.split(separator: ".").last.map(String.init)
let parts = filename.split(separator: ".")

if parts.count > 1 {
return parts.last.map(String.init)
} else {
return nil
}
}

/// Creates a new `File`.
Expand Down

0 comments on commit 57368d4

Please sign in to comment.