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

Commit 38486d5

Browse files
authored
Fix #18: Relative paths passed to CLI don't work (#20)
* Fix #18: Relative paths passed to CLI don't work * Print the path being analyzed * When running from Xcode use IBAnalyzerTests/ path
1 parent 6c126f2 commit 38486d5

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

IBAnalyzer.xcodeproj/xcshareddata/xcschemes/IBAnalyzer.xcscheme

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@
7272
ReferencedContainer = "container:IBAnalyzer.xcodeproj">
7373
</BuildableReference>
7474
</BuildableProductRunnable>
75+
<CommandLineArguments>
76+
<CommandLineArgument
77+
argument = "$(SRCROOT)/IBAnalyzerTests/"
78+
isEnabled = "YES">
79+
</CommandLineArgument>
80+
</CommandLineArguments>
7581
<EnvironmentVariables>
7682
<EnvironmentVariable
7783
key = "SRCROOT"

IBAnalyzer/main.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,17 @@ if !isInUnitTests {
1919
exit(1)
2020
}
2121

22+
let currentDirectoryPath = FileManager.default.currentDirectoryPath
2223
let path = args[1]
23-
let url = URL(fileURLWithPath: args[1], relativeTo: URL(fileURLWithPath: args[0]))
24+
let url = URL(fileURLWithPath: args[1], relativeTo: URL(fileURLWithPath: currentDirectoryPath))
2425

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

31+
print("Analyzing files located at: \(url.path)")
32+
3033
let runner = Runner(path: url.path)
3134
let issues = try runner.issues(using: [ConnectionAnalyzer()])
3235
for issue in issues {

0 commit comments

Comments
 (0)