From 9ba648e57a6e37366c685326c9997c3e643ce1ef Mon Sep 17 00:00:00 2001 From: pcanterino <> Date: Sun, 21 Dec 2003 14:11:38 +0000 Subject: [PATCH 1/1] If a file or directory shall be renamed and the destination file already exists, a confirmation dialog, which asks if the file should be overwritten, will be displayed. If the destination file already exists and it is a directory, renaming is not allowed. --- modules/Command.pm | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/modules/Command.pm b/modules/Command.pm index 1718982..6b413d0 100644 --- a/modules/Command.pm +++ b/modules/Command.pm @@ -6,7 +6,7 @@ package Command; # Execute Dev-Editor's commands # # Author: Patrick Canterino -# Last modified: 2003-12-18 +# Last modified: 2003-12-21 # use strict; @@ -566,7 +566,7 @@ sub exec_workwithdir($$)
-

Move/Rename directory '$virtual' to: $dir

+

Move/Rename directory '$virtual' to:
$dir


@@ -679,7 +679,44 @@ sub exec_rename($$) if(-e $new_physical) { - return error("A file or directory called '$new_virtual' already exists and this editor is currently not able to ask to overwrite the existing file or directory.",upper_path($virtual)); + if(-d $new_physical) + { + return error("A directory called '$new_virtual' already exists. You cannot replace a directory!",upper_path($virtual)); + } + elsif(not $data->{'cgi'}->param('confirmed')) + { + $dir = encode_entities($dir); + + my $output = htmlhead("Replace existing file"); + $output .= <<"END"; +

A file called '$new_virtual' already exists. Do you want to replace it?

+ +
+ + + + + +

+
+ +
+ + + +

+
+END + + $output .= htmlfoot; + + return \$output; + } + } + + if($data->{'uselist'}->in_use($data->{'new_virtual'})) + { + return error("The target file '$new_virtual' already exists and it is edited by someone else.",$dir); } rename($physical,$new_physical) or return error("Could not move/rename '".encode_entities($virtual)."' to '$new_virtual'.",upper_path($virtual)); -- 2.34.1