-
Notifications
You must be signed in to change notification settings - Fork 775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fs.move doesn't return error on moving same nonexistent folder/file #414
Comments
@zosman1 Confirmed this issue. The reason this behaves this way is that fs-extra is designed to silently do nothing when the source and destination paths are the same. In that case, it doesn't even touch the filesystem, so no error is raised. Right now, I'm questioning the wisdom of silently doing nothing when the source & dest is the same. I wonder if we should error out here? @jprichardson @manidlou thoughts? |
How about this... if the source doesn't exist, return an error? That seems to me to almost certainly be unintentional. |
@jprichardson That's fine with me as a quick fix; but I wonder if we should really just be silently doing nothing when src and dest are the same in the long term. I'll throw a patch together when I get a chance. |
Thanks @RyanZim!
But what is wrong with informing user with an error when src and dest are the same?! We've already doing this for |
Issue:
When i
fs.move()
using two paths that are the same and both are invalid(nonexistent) paths, the function does not return an error, which it should since you are trying to move a nonexistent path.Setup:
This is being ran inside of an electron render, which means its being ran inside of a chrome wrapper. This issue persists through fs-extra 3.0
Example:
fs.move("nonexistent/path","nonexistent/path", (err) => { console.log(err)})
// err returns null
Usage:
I use this in my personal repo:
https://github.com/zosman1/The_Archiver/blob/c65ed9dfb7ae0855b1fcb8026204c8d6876a96af/app/index.js#L25
The text was updated successfully, but these errors were encountered: