-
Notifications
You must be signed in to change notification settings - Fork 81
Open
Description
It is better that py7zlib have an API to retrieve file modes.
I've been working for it and PR soon.
And I'd like to propose supporting Unix file mode (rwx)
p7zip on UNIX has an attribute trick to store a file mode, when FILE_ATTRIBUTE_UNIX_EXTENSION bit is set, then store a mode in high 16bit.
https://github.com/warexify/p7zip/blob/master/CPP/7zip/Archive/7z/7zUpdate.cpp#L882
// p7zip uses the trick to store posix attributes in high 16 bits
if (ui.Attrib & 0x8000)
{
unsigned st_mode = ui.Attrib >> 16;
// st_mode = 00111;
Here is a proposal of API design.
f = fp.getmember(name)
if f.is_executable():
print("%s is an executable" % name)
if f.is_readonly():
print("%s is a read only file" % name)
There are some design issue that how it should be in Windows platform.
A question is whether it checks unix attribute extension only on Unix/Linux/Mac, or always checks it on any platform.
Metadata
Metadata
Assignees
Labels
No labels