Menu

#1504 Remove the feature of deleting entire hard drives

Undefined
fixed
nobody
None
Feature_Request
2024-09-30
2024-09-28
No

You can delete entire hard drives in the "Files" tab. Please remove this feature.

This is a real story. A freshman had been using Code::Blocks while learning C. He placed all source code files under a folder named "c" under his Desktop. He tried to delete the entire folder using the "Files" tab in Code::Blocks. However, he accidentally deleted "C:\" without being aware that this means the entire C drive. As a result, almost all user files were deleted, and all system files survived (since they are protected). Fortunately, there was no valuable data on his computer. However, this feature is indeed very dangerous (there is no option to delete the entire disk in Windows Exploerer). Could you please remove this feature to prevent noobs from destroying their computers?

2 Attachments

Discussion

  • ollydbg

    ollydbg - 2024-09-28

    Firstly, thanks for the report.

    This feature belongs to the File Manager plugin - Code::Blocks. I have never used this plugin expect for file browse.

    Indeed, remove the whole drive is very dangerous, so, the proposed method could be:

    Check to see the current folder is a root folder of a hard disk drives, if it is, just prompt a dialog and say "you are not allowed to delete the drive".

    Any ideas?

     
  • Miguel Gimenez

    Miguel Gimenez - 2024-09-28

    Removing the Delete option if the root folder is selected should be enough:

    Index: src/plugins/contrib/FileManager/FileExplorer.cpp
    ===================================================================
    --- src/plugins/contrib/FileManager/FileExplorer.cpp    (revision 13571)
    +++ src/plugins/contrib/FileManager/FileExplorer.cpp    (working copy)
    @@ -1259,7 +1259,9 @@
                 Popup->Append(ID_FILEDUP,_("&Duplicate"));
                 Popup->Append(ID_FILECOPY,_("&Copy to..."));
                 Popup->Append(ID_FILEMOVE,_("&Move to..."));
    
    -            Popup->Append(ID_FILEDELETE,_("D&elete"));
    +            // Do not show the item if the root folder is selected
    +            if (!m_Tree->IsSelected(m_Tree->GetRootItem()))
    +                Popup->Append(ID_FILEDELETE,_("D&elete"));
             }
             if ( IsBrowsingVCSTree() || IsBrowsingWorkingCopy() )
             {
    
     
  • Miguel Gimenez

    Miguel Gimenez - 2024-09-28

    Probably the "Move to..." menu item should also be guarded.

     
  • Miguel Gimenez

    Miguel Gimenez - 2024-09-29
    • status: open --> fixed
     
  • Miguel Gimenez

    Miguel Gimenez - 2024-09-29

    Fixed in [r13572], thank you.

     

    Related

    Commit: [r13572]

  • Triple Camera

    Triple Camera - 2024-09-30

    Thank you.

     

Log in to post a comment.

MongoDB Logo MongoDB