Skip to content
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

Getting "EISDIR: illegal operation on a directory" when trying to delete a directory with ".delete()" #1249

Closed
rfermann opened this issue Feb 28, 2022 · 0 comments
Labels

Comments

@rfermann
Copy link

Describe the bug
When calling .delete() on a Directory object, EISDIR: illegal operation on a directory, unlink '/your/directory/delete-me' is thrown.

Version: 13.0.3

To Reproduce

import { Project } from "ts-morph";

const project = new Project();

project.addDirectoryAtPath("./delete-me");
project.getDirectoryOrThrow("delete-me").delete();

project.saveSync();

Expected behavior
No error should be thrown. Instead the specified directory should get deleted.

Additional context
In @ts-morph/common unlink is called no matter if the target is a directory or a file. In case of directories rmdirshould be called instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants