From 3c4dc6809c9573ea475a3df6ebfbdd55eb889eae Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Sun, 4 Dec 2022 01:55:07 +0400 Subject: [PATCH] Standardize working directory path (#1317) --- CommandLineTool/main.swift | 4 +++- Sources/SwiftFormat.swift | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CommandLineTool/main.swift b/CommandLineTool/main.swift index ebb0a8f4..1a68379d 100644 --- a/CommandLineTool/main.swift +++ b/CommandLineTool/main.swift @@ -81,4 +81,6 @@ CLI.print = { message, type in } } -exit(CLI.run(in: FileManager.default.currentDirectoryPath).rawValue) +let currentDirectory = URL(fileURLWithPath: FileManager.default.currentDirectoryPath).standardizedFileURL + +exit(CLI.run(in: currentDirectory.path).rawValue) diff --git a/Sources/SwiftFormat.swift b/Sources/SwiftFormat.swift index 6b9e497d..44ef9de5 100644 --- a/Sources/SwiftFormat.swift +++ b/Sources/SwiftFormat.swift @@ -301,7 +301,7 @@ private func processDirectory(_ inputURL: URL, with options: inout Options, logg configCache[inputURL] = args } assert(options.formatOptions != nil) - try options.addArguments(args, in: inputURL.path) + try options.addArguments(args, in: inputURL.standardizedFileURL.path) } /// Line and column offset in source