Search code examples
fileadarestoregnat

It is possible to restore deleted file in Gnat Studio


I accidentally deleted a file in the project and was surprised to find that I didn't know how to get it back. It's not in the trash. It's good that the file was not important. Can you please tell me if there is a way to restore a deleted file, or at least protect it from deletion?


Solution

  • I am afraid that GnatStudio has nothing to do with this, file deletion is done by your OS and Gnat studio just uses the services/APIs that your OS provides to do that. If you work on Linux, I guess that GS deletes the file by calling unlink(), not moving it to some trash.

    • You can try some "undelete" software for your OS. It is not guaranteed to work, but if you did not made many changes to your filesystem, it can do a decent work. (I do not use this type of software myself, so I cannot give you suggestions)
    • If your sources are under version control (e.g., git, bazaar, svn, mercurial, ...) you can at least recover the latest commit of your file. How to do that depends on your VC software.