If you try to untrash a file which needed admin permissions to trash in the first place, you get this error:
julia> Trash.untrash(l[end-3])
ERROR: IOError: open("D:\\unit 8 ssd benchmark.txt", 769, 33206): permission denied (EACCES)
Stacktrace:
[1] uv_error
@ .\libuv.jl:106 [inlined]
[2] open(path::String, flags::UInt16, mode::UInt64)
@ Base.Filesystem .\filesystem.jl:190
[3] sendfile(src::String, dst::String)
@ Base.Filesystem .\file.jl:1127
[4] cp(src::String, dst::String; force::Bool, follow_symlinks::Bool)
@ Base.Filesystem .\file.jl:386
[5] cp
@ .\file.jl:378 [inlined]
[6] rename(src::String, dst::String; force::Bool)
@ Base.Filesystem .\file.jl:1114
[7] rename
@ .\file.jl:1110 [inlined]
[8] #mv#15
@ .\file.jl:428 [inlined]
[9] mv
@ .\file.jl:426 [inlined]
[10] untrash(entry::TrashFile, dest::String; force::Bool, rm::Bool)
@ Trash C:\Users\salmon\.julia\packages\Trash\vZZbf\src\windows.jl:451
[11] untrash
@ C:\Users\salmon\.julia\packages\Trash\vZZbf\src\windows.jl:440 [inlined]
[12] untrash(entry::TrashFile)
@ Trash C:\Users\salmon\.julia\packages\Trash\vZZbf\src\windows.jl:440
[13] top-level scope
@ REPL[18]:1
In Windows, you get prompted like this:
If you run Julia as admin, there is no error.
Trashing an item that requires admin perms of course also errors:
julia> Trash.trash("D:\\unit 5 ssd benchmark.txt")
ERROR: TrashSystemError: PostDeleteItem: Failed to capture paths, recycle path is NULL. Item might not have been recycled?
Stacktrace:
[1] trash(path::String; force::Bool)
@ Trash C:\Users\salmon\.julia\packages\Trash\vZZbf\src\windows.jl:429
[2] trash(path::String)
@ Trash C:\Users\salmon\.julia\packages\Trash\vZZbf\src\windows.jl:363
[3] top-level scope
@ REPL[21]:1
If you try to untrash the same item twice, it expectedly fails, but the error message is non-obvious and printing that error causes another error:
julia> Trash.untrash(l[end])
"H:\\unit 8 ssd benchmark.txt"
julia> Trash.untrash(l[end])
ERROR:
Stacktrace:
[1] untrash(entry::TrashFile, dest::String; force::Bool, rm::Bool)
@ Trash C:\Users\salmon\.julia\packages\Trash\vZZbf\src\windows.jl:441
[2] untrash
@ C:\Users\salmon\.julia\packages\Trash\vZZbf\src\windows.jl:440 [inlined]
[3] untrash(entry::TrashFile)
@ Trash C:\Users\salmon\.julia\packages\Trash\vZZbf\src\windows.jl:440
[4] top-level scope
@ REPL[13]:1
SYSTEM (REPL): showing an error caused an error
ERROR: UndefVarError: `seen` not defined in `Trash`
Suggestion: check for spelling errors or missing imports.
Stacktrace:
[1] showerror
@ C:\Users\salmon\.julia\packages\Trash\vZZbf\src\generic.jl:47 [inlined]
[2] showerror(io::IOContext{Base.TTY}, ex::Trash.TrashFileMissing, bt::Vector{Base.StackTraces.StackFrame}; backtrace::Bool)
@ Base .\errorshow.jl:97
[3] show_exception_stack(io::IOContext{Base.TTY}, stack::Base.ExceptionStack)
@ Base .\errorshow.jl:996
[4] display_error(io::IOContext{Base.TTY}, stack::Base.ExceptionStack)
@ Base .\client.jl:117
[5] #invokelatest#2
@ .\essentials.jl:1055 [inlined]
[6] invokelatest
@ .\essentials.jl:1052 [inlined]
[7] repl_display_error(errio::IO, errval::Any)
@ REPL C:\Users\salmon\.julia\juliaup\julia-1.11.4+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\REPL.jl:387
[8] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{…})
@ REPL C:\Users\salmon\.julia\juliaup\julia-1.11.4+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\REPL.jl:404
[9] (::REPL.var"#70#71"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
@ REPL C:\Users\salmon\.julia\juliaup\julia-1.11.4+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\REPL.jl:378
[10] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
@ REPL C:\Users\salmon\.julia\juliaup\julia-1.11.4+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\REPL.jl:661
[11] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
@ REPL C:\Users\salmon\.julia\juliaup\julia-1.11.4+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\REPL.jl:376
[12] (::REPL.var"#do_respond#96"{…})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
@ REPL C:\Users\salmon\.julia\juliaup\julia-1.11.4+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\REPL.jl:1003
[13] #invokelatest#2
@ .\essentials.jl:1055 [inlined]
[14] invokelatest
@ .\essentials.jl:1052 [inlined]
[15] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
@ REPL.LineEdit C:\Users\salmon\.julia\juliaup\julia-1.11.4+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\LineEdit.jl:2755
[16] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
@ REPL C:\Users\salmon\.julia\juliaup\julia-1.11.4+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\REPL.jl:1474
[17] (::REPL.var"#75#81"{REPL.LineEditREPL, REPL.REPLBackendRef})()
@ REPL C:\Users\salmon\.julia\juliaup\julia-1.11.4+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\REPL.jl:480
Some type information was truncated. Use `show(err)` to see complete types.