Skip to content

Commit 3a116fb

Browse files
committed
Fix renaming to existing file/dir
1 parent bfe1023 commit 3a116fb

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

filemanager-plugin/filemanager.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,13 @@ function rename_at_cursor(bp, args)
647647
local old_path = scanlist[y].abspath
648648
-- Join the path into their supplied rename, so that we have an absolute path
649649
local new_path = dirname_and_join(old_path, new_name)
650+
651+
-- Check if the name is already taken by a file/dir
652+
if path_exists(new_path) then
653+
micro.InfoBar():Error("You can't create a file/dir with a pre-existing name")
654+
return
655+
end
656+
650657
-- Use Go's os package for renaming the file/dir
651658
local golib_os = import("os")
652659
-- Actually rename the file

0 commit comments

Comments
 (0)