Clipboard icon indicating copy to clipboard operation
Clipboard copied to clipboard

Cut and paste + โ€œdon't replaceโ€ should not remove the original file

Open YDX-2147483647 opened this issue 9 months ago โ€ข 0 comments

Describe the bug

When cb paste and the file already exists, we can say no to stop the process. In this case, everything should be cancelled, but v0.9.0 (commit 9af03b2) removes it.

To Reproduce Steps to reproduce the behavior:

$ mkdir from && date > from/a.txt
$ mkdir to && date > to/a.txt
$ cb cut from/a.txt
โœ”  Cut one item

$ tree
./
โ”œโ”€โ”€ from/
โ”‚   โ””โ”€โ”€ a.txt
โ””โ”€โ”€ to/
    โ””โ”€โ”€ a.txt

$ cd to && cb paste
โฌค The item a.txt already exists here. Do you want to replace it? Use all to replace all existing, or skip to replace nothing. [(y)es/(n)o)/(a)ll/(s)kip]
# Say โ€œnoโ€ here.

$ tree ..
../
โ”œโ”€โ”€ from/
โ””โ”€โ”€ to/
    โ””โ”€โ”€ a.txt

Now from/a.txt is removed.

Expected behavior

from/a.txt should not be removed.

Screenshots

N/A

Version

CB 0.9.0 (commit 9af03b2) from scoop, Windows 10.

Questionnaire Check these boxes to see if your issue is valid or not.

  • [ ] If I compiled CB, then any errors that may be present don't mention "LTO error" (this is sadly a bug with the compiler, not Clipboard)
  • [ ] If I compiled CB, then any errors that may be present don't mention "XYZ has not been defined in namespace std" (this sadly means you need a compiler with C++20 support, so upgrade first)
  • [ ] I check all these boxes without reading them
  • [ ] I think bachata is the best music
  • [x] I'm using the latest commit/release (we only support the latest)
  • [ ] If I downloaded CB from GitHub Actions or with the install script, any errors that may be present don't mention "GLIBC XYZ not found" (your system is sadly too outdated for CB, so upgrade it)

Additional context Add any other context about the problem here.

For those who want to find their file back: Search the temp dir (see cb config).

YDX-2147483647 avatar May 10 '24 07:05 YDX-2147483647