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

Make sure file path exist before creat the file #30

Merged
merged 3 commits into from
Apr 30, 2024
Merged

Make sure file path exist before creat the file #30

merged 3 commits into from
Apr 30, 2024

Conversation

KortanZ
Copy link
Contributor

@KortanZ KortanZ commented Apr 29, 2024

uv.fs_open() works equivalent to open(2), which will return ENOENT when create file but file parent folder dose not exists. So we need to create directory before create the file.

@chipsenkbeil
Copy link
Owner

@KortanZ is there a failure somewhere in the plugin that you encountered because the directory did not exist?

@KortanZ
Copy link
Contributor Author

KortanZ commented Apr 29, 2024

@chipsenkbeil Yes, the default db dir is BASE_PATH .. db, and org-roam will not create the BASE_PATH by default. Which cause the problem. I'm using windows btw.

lua/org-roam/core/utils/io.lua Outdated Show resolved Hide resolved
@chipsenkbeil chipsenkbeil merged commit 4961ea3 into chipsenkbeil:main Apr 30, 2024
4 checks passed
@KortanZ
Copy link
Contributor Author

KortanZ commented Apr 30, 2024

Just for curious, this problem should happened on all platform theoretically and really easy to trigger, just a fresh install and open neovim. Is there something wrong with the test or is this problem just happend on Windows by some reason? I've not test other platform.

@chipsenkbeil
Copy link
Owner

Just for curious, this problem should happend on all platform theoretically and really easy to trigger, just a fresh install and open neovim. Is there something wrong with the test or is this problem just happend on Windows by some reason? I've not test other platform.

Not sure why I didn't run into it. I've worked on this across three Mac computers. It doesn't seem like a Windows issue, but I haven't tried this plugin on windows yet.

I opened and issue to add a github action to test on Windows.

@KortanZ
Copy link
Contributor Author

KortanZ commented Apr 30, 2024

Not sure why I didn't run into it.

Have you tried delete stdpath("data")/org-roam.nvim and reopen nvim? I run into this problem because this dir dose not exist and not create by plugin by default.

chipsenkbeil pushed a commit that referenced this pull request May 6, 2024
* Make sure file path exist before creating the file by making the directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants