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

Decompression error when folder already exists at the place of output file #136

Closed
marcospb19 opened this issue Nov 2, 2021 · 8 comments · Fixed by #141 or #190
Closed

Decompression error when folder already exists at the place of output file #136

marcospb19 opened this issue Nov 2, 2021 · 8 comments · Fixed by #141 or #190
Labels
bug Something isn't working

Comments

@marcospb19
Copy link
Member

image

Ouch doens't really know that there is a folder there, it just gives this error message.

When it's not a folder, but a simple text file, it does ask if should overwrite.

@marcospb19 marcospb19 added the bug Something isn't working label Nov 2, 2021
@SpyrosRoum
Copy link
Contributor

Should we ask to overwrite if there is a directory as well or simply improve the error message?

@marcospb19
Copy link
Member Author

I think we should ask like we do for other regular files.

@SpyrosRoum
Copy link
Contributor

When it's not a folder, but a simple text file, it does ask if should overwrite.

Unless I'm doing something wrong, this is not true, it simply overwrite the file:
image

@marcospb19
Copy link
Member Author

marcospb19 commented Nov 2, 2021

Try it with an archive format, seems like overwrite questions are not being asked for single-file compression formats (like .gz .xz .bz .zst)? If so, that should be another new issue.

@SpyrosRoum
Copy link
Contributor

I think the issue in essentially the same and I'm in the process of fixing it all so is it okay if I do them in the same pr?

@marcospb19
Copy link
Member Author

Sure!

@marcospb19 marcospb19 changed the title Decompression error when folder already exists Decompression error when folder already exists at the place of output file Nov 2, 2021
@marcospb19 marcospb19 reopened this Nov 10, 2021
@marcospb19
Copy link
Member Author

Still an issue, probably at:

ouch/src/utils/fs.rs

Lines 23 to 30 in 7a4dcb2

/// Creates the dir if non existent.
pub fn create_dir_if_non_existent(path: &Path) -> crate::Result<()> {
if !path.exists() {
fs::create_dir_all(path)?;
info!("directory {} created.", to_utf(path));
}
Ok(())
}

How to reproduce:

image

@SpyrosRoum
Copy link
Contributor

Hm I guess I missed that case but it seems like an easy fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants