-
Notifications
You must be signed in to change notification settings - Fork 207
Closed
swiftlang/swift-corelibs-foundation
#5093Labels
good first issueGood for newcomersGood for newcomers
Description
Description
itemReplacementDirectoryName has forgotten the closing bracket when attempt is greater than 0. It is a local function in FileManager.url(for:in:appropriateFor:create:).
Steps to reproduce
$ rmdir /tmp/TemporaryItems/*
$ swift repl
Welcome to Swift version 6.0.1 (swift-6.0.1-RELEASE).
Type :help for assistance.
1> import Foundation
2> try FileManager.default.url(for: .itemReplacementDirectory, in: .userDomainMask, appropriateFor: URL(filePath: "/tmp"), create: false).path
$R0: String = "/tmp/TemporaryItems/(A Document Being Saved By replswift)"
3> try FileManager.default.url(for: .itemReplacementDirectory, in: .userDomainMask, appropriateFor: URL(filePath: "/tmp"), create: false).path
$R1: String = "/tmp/TemporaryItems/(A Document Being Saved By replswift 2"
4> try FileManager.default.url(for: .itemReplacementDirectory, in: .userDomainMask, appropriateFor: URL(filePath: "/tmp"), create: false).path
$R2: String = "/tmp/TemporaryItems/(A Document Being Saved By replswift 3"
5> try FileManager.default.url(for: .itemReplacementDirectory, in: .userDomainMask, appropriateFor: URL(filePath: "/tmp"), create: false).path
$R3: String = "/tmp/TemporaryItems/(A Document Being Saved By replswift 4"
6> ^DAs you can see, it outputted:
"/tmp/TemporaryItems/(A Document Being Saved By replswift)""/tmp/TemporaryItems/(A Document Being Saved By replswift 2""/tmp/TemporaryItems/(A Document Being Saved By replswift 3""/tmp/TemporaryItems/(A Document Being Saved By replswift 4"- ...
Expected behavior
I think it should output:
"/tmp/TemporaryItems/(A Document Being Saved By replswift)""/tmp/TemporaryItems/(A Document Being Saved By replswift 2)""/tmp/TemporaryItems/(A Document Being Saved By replswift 3)""/tmp/TemporaryItems/(A Document Being Saved By replswift 4)"- ...
Environment
$ swift --version
Swift version 6.0.1 (swift-6.0.1-RELEASE)
Target: aarch64-unknown-linux-gnu
$ uname -a
Linux Raspberry-beetle 6.6.51-v8-16k+ swiftlang/swift-corelibs-foundation#1796 SMP PREEMPT Fri Sep 13 14:39:41 BST 2024 aarch64 GNU/LinuxMetadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomers