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

Problems with paths longer than 259 characters #45

Closed
fabri9532 opened this issue May 18, 2020 · 3 comments
Closed

Problems with paths longer than 259 characters #45

fabri9532 opened this issue May 18, 2020 · 3 comments
Assignees

Comments

@fabri9532
Copy link

I have this path on my hard disk (without quotes):
"C:\Cartella Condivisa\DITTE STUDIO BELLON SRL\CONTABILITA' ORDINARIE\GENTOREMONA SRL IN LIQUIDAZIONE (CESSATA 01.04.2019)\BILANCIO FINALE DI LIQUIDAZIONE\BILANCIO FINALE DI LIQUIDAZIONE"

In the final folder I have the following files (without quotes):
"Delega Gentono Fabio in favore della moglie Torramini Silvana Claudia.as"
"Delega Gentono Fabio in favore della moglie Torramini Silvana Claudia.pdf"
"Delega Gentono Fabio in favore della moglie Torramini Silvana Claudia.pdf.p7m"

I use this code:
bit7z::Bit7zLibrary lib{ L"7z.dll" };

	bit7z::BitCompressor compressor{ lib, bit7z::BitFormat::SevenZip };

	compressor.setCompressionMethod(bit7z::BitCompressionMethod::Lzma2);
	compressor.setCompressionLevel(bit7z::BitCompressionLevel::FAST);

	compressor.compressDirectory(L"C:\\Cartella condivisa", L"D:\\Output.7z");

Only the first file "Delega Gentono Fabio in favore della moglie Torramini Silvana Claudia.as" is present in the "Output.7z" and no error occurs.

I use 7zip Dll v19.00, Bit7z v3.1.1 and Windows 10 x64 v1909
I have tested with "Windows 10 long path name" enabled and disabled: same result.

I have 7zip installed (v19.00) and if I compress "Cartella Condivisa", all the files are compressed (also if "Windows 10 long path name" is disabled).

@rikyoz rikyoz self-assigned this May 18, 2020
@rikyoz
Copy link
Owner

rikyoz commented May 18, 2020

I use 7zip Dll v19.00, Bit7z v3.1.1 and Windows 10 x64 v1909
I have tested with "Windows 10 long path name" enabled and disabled: same result.

This is really weird. Have you tried to prepend \\?\ to the path passed to BitCompressor::compressDirectory, e.g., L"\\?\C:\\Cartella condivisa"?

@fabri9532
Copy link
Author

fabri9532 commented May 18, 2020

If I prepend "\\?\" it works properly.
If this behavior is normal, I think, if I don't prepend "\\? \" and there is a paths longer than 259 characters, bit7z should throw an exception or alternatively add note in the documentation to check the length externally to bit7z.

Thanks, Fabrizio.

@rikyoz
Copy link
Owner

rikyoz commented Oct 1, 2023

Added the option BIT7Z_AUTO_PREFIX_LONG_PATHS for automatically prepend \\?\ to paths in v4.0.0.

@rikyoz rikyoz closed this as completed Oct 1, 2023
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

No branches or pull requests

2 participants