Skip to content

Commit

Permalink
Fix misidentification of .swift-suffixed directory as a Swift file (#575
Browse files Browse the repository at this point in the history
)
  • Loading branch information
1ec5 authored and jpsim committed Jan 29, 2019
1 parent 4a0f386 commit 8b082a1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

##### Bug Fixes

* None.
* “.swift”-suffixed directory in xcodebuild arguments no longer detected as
Swift file.
[Minh Nguyễn](https://github.com/1ec5)
[#574](https://github.com/jpsim/SourceKitten/issues/574)

## 0.22.0

Expand Down
4 changes: 3 additions & 1 deletion Source/SourceKittenFramework/String+SourceKitten.swift
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,9 @@ extension NSString {

extension String {
internal var isFile: Bool {
return FileManager.default.fileExists(atPath: self)
var isDirectory: ObjCBool = false
let exists = FileManager.default.fileExists(atPath: self, isDirectory: &isDirectory)
return exists && !isDirectory.boolValue
}

internal func capitalizingFirstLetter() -> String {
Expand Down
2 changes: 1 addition & 1 deletion Source/SourceKittenFramework/library_wrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ let toolchainLoader = Loader(searchPaths: [
userApplicationsDir?.xcodeDeveloperDir.toolchainDir,
userApplicationsDir?.xcodeBetaDeveloperDir.toolchainDir
].compactMap { path in
if let fullPath = path?.usrLibDir, fullPath.isFile {
if let fullPath = path?.usrLibDir, FileManager.default.fileExists(atPath: fullPath) {
return fullPath
}
return nil
Expand Down

0 comments on commit 8b082a1

Please sign in to comment.