From 0fd573c8b204196134b0990d9485918973a205df Mon Sep 17 00:00:00 2001 From: JP Simard Date: Tue, 6 Oct 2015 15:51:30 -0700 Subject: [PATCH] Deduplicate files in the current directory. Fixes #154. --- CHANGELOG.md | 4 ++++ Source/SwiftLintFramework/NSFileManager+SwiftLint.swift | 5 ++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8bcca5df4..680595a502 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,10 @@ [JP Simard](https://github.com/jpsim) [#151](https://github.com/realm/SwiftLint/issues/151) +* Deduplicate files in the current directory. + [JP Simard](https://github.com/jpsim) + [#154](https://github.com/realm/SwiftLint/issues/154) + ## 0.2.0: Tumble Dry diff --git a/Source/SwiftLintFramework/NSFileManager+SwiftLint.swift b/Source/SwiftLintFramework/NSFileManager+SwiftLint.swift index cf5f656afa..1f78892576 100644 --- a/Source/SwiftLintFramework/NSFileManager+SwiftLint.swift +++ b/Source/SwiftLintFramework/NSFileManager+SwiftLint.swift @@ -10,8 +10,7 @@ import Foundation extension NSFileManager { public func allFilesRecursively(directory directory: String) -> [String] { - let relativeFiles = (try! contentsOfDirectoryAtPath(directory)) + - (try! subpathsOfDirectoryAtPath(directory)) - return relativeFiles.map((directory as NSString).stringByAppendingPathComponent) + return try! subpathsOfDirectoryAtPath(directory) + .map((directory as NSString).stringByAppendingPathComponent) } }