mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
DriverTool: adjust argv[0] scanning for CAS
Ensure that we nativize the path and consider only the filename starting prefix to account for file suffixes (e.g. `.exe` on Windows). This ensures that we properly support other platforms.
This commit is contained in:
@@ -196,7 +196,9 @@ private:
|
|||||||
}
|
}
|
||||||
// drop swift-frontend executable path and leading `-frontend` from
|
// drop swift-frontend executable path and leading `-frontend` from
|
||||||
// command-line.
|
// command-line.
|
||||||
if (StringRef(FrontendArgs[0]).ends_with("swift-frontend"))
|
llvm::SmallString<261> path;
|
||||||
|
llvm::sys::path::native(Twine{FrontendArgs[0]}, path);
|
||||||
|
if (llvm::sys::path::filename(path).starts_with("swift-frontend"))
|
||||||
FrontendArgs.erase(FrontendArgs.begin());
|
FrontendArgs.erase(FrontendArgs.begin());
|
||||||
if (StringRef(FrontendArgs[0]) == "-frontend")
|
if (StringRef(FrontendArgs[0]) == "-frontend")
|
||||||
FrontendArgs.erase(FrontendArgs.begin());
|
FrontendArgs.erase(FrontendArgs.begin());
|
||||||
|
|||||||
Reference in New Issue
Block a user