Page 1 of 1

Improve support for editing files inside R-O archives

Posted: 2012-04-14, 20:32 UTC
by MarcinW
Consider the following situation:

1) we have a READ ONLY archive (say ZIP archive) containing text file(s)
2) enter into archive, select any file and press F4
3) file is being unpacked to TEMP dir (after confirming) and editor starts (notepad by default)
4) edit file, save it and close notepad
5) now TCMD displays message box: "The file xxx.txt has changed. Do you want to repack it into c:\test.zip?"
6) after pressing "Yes", TCMD displays message box: "Error: Cannot write c:\test.zip! Please remove the write protection!"

Now the only way to recover our edited file contents is to go manually to the TEMP directory and find a proper file.

So my suggestion is: use the solution already existing - as when overwriting an read-only file (when copying/moving): instead of displaying "Error: Cannot write c:\test.zip! Please remove the write protection!", display: "The file c:\test.zip is READ ONLY! Do you want to overwrite it anyway?".

Regards!

Posted: 2012-04-14, 21:26 UTC
by MaxX
2MarcinW
Better decision is asking about R/O archive BEFORE editing.
Just like this:
1. Enter R/O zip
2. press "F4"
3. msg. "arch is R/O, continue? y/n"
And then you decide - you wish to lose later changes or not.

Posted: 2012-04-14, 23:05 UTC
by petermad
I support that TC should offer to pack and repack write protected archives.

Posted: 2012-04-15, 00:50 UTC
by MarcinW
There is also some inconsistency between copying/moving files and editing contents of an archive:


copying/moving:

1) when replacing HIDDEN or SYSTEM file -> "The file x has either the attribute HIDDEN or SYSTEM! Do you want to overwrite it anyway?"
else
2) when replacing READ-ONLY file -> "The file x is READ ONLY! Do you want to overwrite it anyway?"
else
overwrite without any further warnings


editing contents of an archive:

HIDDEN and SYSTEM attributes of an archive are completely ignored - no errors or warnings. Only the READ-ONLY generates an error. In my private opinion, it should be exactly as when copying/moving.


P.S.
Exactly same behavior (as when editing file inside a R-O archive) is when simply replacing a file in a R-O archive (using F5/F6).

Posted: 2012-04-15, 06:04 UTC
by MVV
Problem with read-only attribute is that OS prevents file modifications (and its deletion) until it has this attribute, so it is necessary to remove it before opening a file for writing. Other attributes have no such power.

I agree that TC should warn if user tries to edit a file in read-only archive.

Posted: 2012-04-15, 11:50 UTC
by MaxX
MVV wrote:I agree that TC should warn if user tries to edit a file in read-only archive.
And how can you imagine repacking of archives on optical drives? :lol:
They're R/O, too. But you can't change them directly due to ODD's abilities.

Posted: 2012-04-15, 13:33 UTC
by MarcinW
@MaxX:

There is no problem with CD/DVD drives.

When we want to replace a file with the R-O attribute (using F5/F6), there is a warning: "The file x is READ ONLY! Do you want to overwrite it anyway?".

Now there are two possibilities:
1) file is being replaced
2) file is on the CD/DVD drive - we get a warning: "Error: Cannot write X! Please remove the write protection!".

Same behavior can be implemented for R-O archives.