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

Commit

Permalink
Fix #18: Relative paths passed to CLI don't work (#20)
Browse files Browse the repository at this point in the history
* Fix #18: Relative paths passed to CLI don't work

* Print the path being analyzed

* When running from Xcode use IBAnalyzerTests/ path
  • Loading branch information
fastred authored Feb 5, 2017
1 parent 6c126f2 commit 38486d5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@
ReferencedContainer = "container:IBAnalyzer.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<CommandLineArguments>
<CommandLineArgument
argument = "$(SRCROOT)/IBAnalyzerTests/"
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments>
<EnvironmentVariables>
<EnvironmentVariable
key = "SRCROOT"
Expand Down
5 changes: 4 additions & 1 deletion IBAnalyzer/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@ if !isInUnitTests {
exit(1)
}

let currentDirectoryPath = FileManager.default.currentDirectoryPath
let path = args[1]
let url = URL(fileURLWithPath: args[1], relativeTo: URL(fileURLWithPath: args[0]))
let url = URL(fileURLWithPath: args[1], relativeTo: URL(fileURLWithPath: currentDirectoryPath))

guard FileManager.default.fileExists(atPath: url.path) else {
print("Path \(url.path) doesn't exist.")
exit(1)
}

print("Analyzing files located at: \(url.path)")

let runner = Runner(path: url.path)
let issues = try runner.issues(using: [ConnectionAnalyzer()])
for issue in issues {
Expand Down

0 comments on commit 38486d5

Please sign in to comment.