Add a flag to "FSUtil.ReadDir" to avoid pop-up window when reading a zip

If a zip file is compressed with password, DOpus.FSUtil.ReadDir(that.zip) will pop-up a window requesting password input.
Now,I want to add a column [Need password] to show "yes" if a zip file is compressed with password.
I think FSUtil.ReadDir can do it. like this:

var needPw = DOpus.FSUtil.ReadDir(some.zip,"p"); 
// the "p" flag means not to pop-up window requesting password input.
if (needPw.errror == value)  data.value = "yes";
//This value is defined by DO when reading a zip compressed with password.

I hope you can understand what I'm saying. sorry for my english...

Instead of FSUtil.ReadDir, try one of these:

FSUtil: Exists, GetType and PathType methods no longer trigger password prompts if given a path involving an encrypted archive.

(From the detailed Opus 13 release notes, Miscellaneous Scripting [Directory Opus Manual])

1 Like

but cannot detect whether a zip is an encrypted archive...

We'll add a p flag for this in the next beta release.

1 Like

if some.rar is an encrypted archive, fsu.OpenFile the file in it will pop-up window too.
fsu.OpenFile("some.rar\\item.jpg")
So, we need to add a new flag to fsu.OpenFile too.
Since the flag "p" is used for "Permit deletion", we can use "-" .

var item = "C:\\some.rar\\item.jpg";
var file = fsu.OpenFile(item,"-"); // "-" means no pop-up window 
DOpus.Output(file.error); // error code is 5.

You could use ReadDir to check if the archive can be opened without a password, then OpenFile if it can. Won't have much performance difference, as the archive listing will be cached and needs to happen in both cases.

I think that makes more sense than adding flags to every call that can open or look at a file or directory listing.