rushsteve1/trash-d

Cannot trash directories on a different partition

SimonBranch opened this issue · 3 comments

From util.d:

void renameOrCopy(in string src, in string tgt) {
    try {
        src.rename(tgt);
    } catch (FileException e) {
        if (e.errno != EXDEV)
            throw e;

        src.copy(tgt);
        src.remove();
    }
}

Note that src.copy(tgt) only works for regular files — it'll throw EISDIR is src is a directory. A better approach here is to recursively copy and delete src.

Related to #1 #2

Closing this as fixed in version 15