Showing posts with label ide. Show all posts
Showing posts with label ide. Show all posts

Thursday, February 2, 2012

Open current file from Delphi IDE in Windows Explorer


When working in the Delphi IDE, I often want to access the currently opened file from within Windows Explorer. For intance, because my Version Control client du jour integrates way nicer with the Windows Explorer than within the IDE. Or because I am on an ancient version control system that requires me to manually clear the read-only flag on files whenever I want to do some local hacking (*cough* Visual SourceSafe *cough*).

Anyway, I always setup a nice little "Tool" in the Delphi IDE that allows me to do this through a simple ALT-T, E key combo. And on every Delphi reinstall on a new machine it turns out I forgot what the exact parameters are, and google always deludes me when I try to look it up.

Setup
  
  1. From the IDE main menu, select Tools, Configure Tools.
  2. Select Add
  3. Set Title to &Explore
  4. Set Program to Explorer
  5. Set Parameters to /select, $EDNAME



Done.

Tuesday, January 17, 2012

Removing the __history folders from a Delphi project

These days, the Delphi IDE maintains a history of all edits applied to your source files. It keeps track of these changes in a hidden subdirectory called __history. Which is nice and all(*), but as a developer I always have Show hidden files and folders turned on, which will make most of my VCS clients happily check the history folders into the real version control system... ouch!

Making a clean sweep

In my home setup, I use a simple clean.bat before each checking, including the following line:


for /d /r . %%d in (__history) do @if exist "%%d" rd /Q /S "%%d"


The recursive for + exist has a big advantage over the classic DIR /S ... it will not throw an obnoxious File Not Found if there happen to be no history folders at all.

Addendum: disabling the history in the IDE

Delphi 2010 and above make it really easy to disable the functionality. From the main menu, choose Tools, Options, Editor Options, then uncheck the Create backup files checkbox.



No more backup files or _history folders will be created, works like a charm!


(*) Not really, and I tend to turn it off... but I suspect Delphi updates turn it back on, and I share source with various people that prefer to leave it on, so I always end up with a lot of these folders in my source tree anyway.