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

saveWidget removed all files in my output folder #417

Open
jgrzadziel opened this issue Aug 18, 2021 · 2 comments · May be fixed by #468
Open

saveWidget removed all files in my output folder #417

jgrzadziel opened this issue Aug 18, 2021 · 2 comments · May be fixed by #468
Assignees

Comments

@jgrzadziel
Copy link

As in title, saveWidget removed completely all files in my output folder, including .csv datasets, .R files, excel documents etc.
I lost a lot of data, and I couldn't find it even in trash.
I had to use some files recovery tool but why this happened? Is the output folder supposed to be empty before running the script ?
Or there is something wrong with my path symbols/folders names ?

This was mu script"

saveWidget(chord_interactive, file = "chord_interactive.html",libdir = "C:/Users/Anna MG/Desktop/Projekty/Lasy - statut/2019/NGS/Z_pola_i_lasu/16S/tables")

Thank you for help

@meabhm
Copy link

meabhm commented Apr 26, 2023

This happened me too. I think the issue is with the libdir option. The directory isn't removed if you omit it. It's not great though, I did lose a directory containing important data.

gadenbuie added a commit that referenced this issue May 1, 2023
Fixes #417 and saves users from accidentally deleting important files by throwing an error when the user provides a `libdir` that contains files. This is only an issue when `selfcontained = TRUE` because otherwise the files written into `libdir` are not removed after saving the widget html.
@gadenbuie gadenbuie self-assigned this May 1, 2023
@gadenbuie
Copy link
Collaborator

Thank you @jgrzadziel and @meabhm for reporting the issue! I'm sorry you lost files by calling saveWidget(). @meabhm is right that when you provide libdir to render a selfcontained = TRUE widget, the libdir is removed afterwards (because the files were all embedded into the file HTML). In general, you don't need to provide libdir; I think the expectation is that most users wouldn't set libdir.

In any case, thanks to your feedback, I've proposed adding a check that will throw an error if libdir is provided and points to a directory that contains files. Hopefully that will save you and others from a similar fate of disappearing files.

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 a pull request may close this issue.

3 participants