Skip to content

Commit 659e7d3

Browse files
committed
Fixed issue where config paths containing spaces
Fixed issue where config paths containing spaces were being percent-encoded (e.g., "root/a aaa/.prefire.yml" became "root/a%20aaa/.prefire.yml"), causing FileManager.default.fileExists(atPath:) to fail. Added percentEncoded: false parameter to path() call to ensure spaces and special characters are properly handled.
1 parent 001157d commit 659e7d3

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

Plugins/PrefireTestsPlugin/Plugin.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ struct PrefireTestsPlugin: BuildToolPlugin {
2929

3030
let environment = [
3131
"TARGET_DIR": String(describing: target.directory),
32-
"PACKAGE_DIR": context.package.directoryURL.path(),
32+
"PACKAGE_DIR": context.package.directoryURL.path(percentEncoded: false),
3333
]
3434

3535
return [
@@ -74,7 +74,7 @@ struct PrefireTestsPlugin: BuildToolPlugin {
7474
arguments.append(contentsOf: sources)
7575

7676
let environment = [
77-
"PROJECT_DIR": context.xcodeProject.directoryURL.path(),
77+
"PROJECT_DIR": context.xcodeProject.directoryURL.path(percentEncoded: false),
7878
]
7979

8080
return [

PrefireExecutable/Sources/prefire/Commands/Playbook/GeneratePlaybookCommand.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct GeneratedPlaybookOptions {
2727
if let template = config?.playbook.template, let targetPath {
2828
let targetURL = URL(filePath: targetPath)
2929
let templateURL = targetURL.appending(path: template)
30-
self.template = Path(templateURL.absoluteURL.path())
30+
self.template = Path(templateURL.absoluteURL.path(percentEncoded: false))
3131
} else if let template {
3232
self.template = Path(template)
3333
}

PrefireExecutable/Sources/prefire/Commands/Tests/GenerateTestsCommand.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct GeneratedTestsOptions {
4242
if let template = config?.tests.template, let testTargetPath = self.testTargetPath {
4343
let testTargetURL = URL(filePath: testTargetPath.string)
4444
let templateURL = testTargetURL.appending(path: template)
45-
self.template = Path(templateURL.absoluteURL.path())
45+
self.template = Path(templateURL.absoluteURL.path(percentEncoded: false))
4646
} else if let template {
4747
self.template = Path(template)
4848
}

PrefireExecutable/Sources/prefire/Config/ConfigPathBuilder.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ enum ConfigPathBuilder {
2424
configURL.append(component: configFileName)
2525
}
2626

27-
possibleConfigPaths.append(configURL.absoluteURL.path())
27+
possibleConfigPaths.append(configURL.absoluteURL.path(percentEncoded: false))
2828
}
2929

3030
// Add the default path
3131
let configURL = URL(filePath: configFileName) // Relative to the current directory
32-
possibleConfigPaths.append(configURL.absoluteURL.path())
32+
possibleConfigPaths.append(configURL.absoluteURL.path(percentEncoded: false))
3333

3434
return possibleConfigPaths
3535
}

0 commit comments

Comments
 (0)