Skip to content

Commit c3f9e52

Browse files
authored
Merge pull request #154 from mgacy/153-fix-plugin-paths
Fix config file lookup when project path contains spaces
2 parents 7842b30 + da736f0 commit c3f9e52

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

PrefireExecutable/Sources/prefire/Config/ConfigPathBuilder.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@ enum ConfigPathBuilder {
1616
continue
1717
}
1818

19+
// Decode any percent-encoded characters in the input path
20+
let decodedPath = path.removingPercentEncoding ?? path
21+
1922
// This will build the absolute path relative to the current directory
20-
var configURL = URL(filePath: path)
23+
var configURL = URL(filePath: decodedPath)
2124

2225
// Add the config file name if not provided
2326
if configURL.lastPathComponent != configFileName {

PrefireExecutable/Tests/PrefireTests/ConfigPathBuilderTests.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,16 @@ class ConfigPathBuilderTests: XCTestCase {
8989

9090
XCTAssertEqual(result, expectableResult)
9191
}
92+
93+
func test_possibleConfigPathsWithPercentEncodedSpaces() {
94+
let configPath = "Test%20Folder/" + configFileName
95+
let result = ConfigPathBuilder.possibleConfigPaths(for: configPath, testTargetPath: nil, packagePath: nil)
96+
97+
let expectableResult = [
98+
FileManager.default.currentDirectoryPath + "/Test Folder/" + configFileName,
99+
FileManager.default.currentDirectoryPath + "/" + configFileName,
100+
]
101+
102+
XCTAssertEqual(result, expectableResult)
103+
}
92104
}

0 commit comments

Comments
 (0)