ashkulz / NppFTP

Plugin for Notepad++ allowing FTP, FTPS, FTPES and SFTP communications
https://ashkulz.github.io/NppFTP/
322 stars 93 forks source link

Feature request: Present the user with a confirm dialog if the file is already open in N++ #328

Open dcorsello opened 2 years ago

dcorsello commented 2 years ago

Description of the Issue

Currently, if a file is open in N++, and it is accidentally reopened via NppFTP, the locally cached file is always overwritten. The user should be warned that the file is already open, and given the choice to cancel the download or proceed and overwrite. This is related to issue #327. A fix of that issue will prevent catastrophic loss of data. But it's sub-optimal behavior for the download to always proceed with no warning.

I believe standard behavior in a file editor is to prevent a file from being reopened if it's already open, to warn on save-as if a file with the same name exists, and to allow saves with no warning. On the other hand, in my experience, FTP clients generally warn both on download and upload if data will be overwritten, with options to proceed or cancel, and configuration options to permanently or semi-permanently disable "overwrite" warnings.

So, what I'm asking for is either 1) behavior that's a hybrid between file editor and FTP client behavior, in which: a) the user is warned, not blocked, on file reopen, with the option to cancel or proceed; and b) saves/uploads always proceed without warning; or 2) behavior that's similar to FTP client behavior, in which warnings are issued whenever data will be overwritten, with options to cancel or proceed, and with a configuration option to permanently disable upload warnings.

Steps to Reproduce the Issue

  1. Open a file in N++ via NppFTP.
  2. Open the same file again via NppFTP.

Desired Behavior

When the file is reopened, a dialog appears, warning that the file is currently open in N++, and prompting the user to choose to either cancel or overwrite the file on disk.

Current Behavior

When the file is reopened via NppFTP, it is downloaded with no warning and the local file is overwritten.

Debug Information

I'm using N++ v8.1.9.2 and a version of NppFTP 0.29.8 that's patched per the proposed fix in issue #327. My OS is Windows 10.