tags:

views:

238

answers:

4

Hello All!

Is there a rule of thumb that .pas, .dfm and .dpr files should not be removed?

While opening/working with concerned project files ,Unit1.pas,Form1,Unit1.dpr etc are automatically created by the IDE in the same project-folder.As they were not related to my proj,I inadvertently deleted them.Will that cause any issue?

Further should the same project be saved with a new name every time one saves it? Like PfojDel.dpr
edit then save as PfojDel1.dpr edit then save as PfojDel2.dpr etc

Kindly help

Thanks and Regards

Vas

+7  A: 

Your first question's pretty straightforward. Any file that you need to compile into your project needs to be present on the disc. Anything else can go.

As for changing your project file name, that's a big hassle. Sounds like you're trying to keep a history of your changes. If so, I'd look into version control if I were you. TortoiseSVN makes it pretty easy to create a simple source code repository, either on your own hard drive or a networked system, that you can check changes into to keep a history.

Mason Wheeler
Thanks Mason!The problem is i am trying to run Delphi code which is currently in use(and hence should "Build" perfectly).But I am getting all sort of errors in my project and also strangely in THTML files. I asked the question because I did remove some Project1.dpr,Unit1.pas ...etc which were formed when i opened IDE /saved project.They are NOT NEEDED FOR MY PROJECT so I removed them.So was sorried whether they might have affected my project.
vas
Yeah. If something's not needed for your project, (and not needed for any *other* project!), you can delete it safely.
Mason Wheeler
+3  A: 

The dfm file contains the component information for the form (or data module). The dpr is the basic pascal program file. It is also the base of the project (normally contains the list of files in the project).

Deleting them is not a disaster, but you need some time to recreate them (specially if the form is big). But if you have the choice, do not delete them.

The dfm files are created because they contain the information you provide with the form designer (position of controls and the value of their published properties).

If you have renamed your project, you can delete the other files without problem. This is also true for units that are not used anymore.

You don't have to use a different name every time you save the project. If you want to keep track of changes, use source control. (Every wise programmer should use source control and backup the files frequently).

Gamecat
+3  A: 

See http://delphi.about.com/od/beginners/a/aa032800a.htm for an explanation on all most file extensions you come across when developing a Delphi application.

Lars Truijens
+2  A: 

Under normal circumstances you shouldn't have any Unit1/Form1 files on your system. The first time you save/compile/run a project with a new file the IDE will prompt you for the filename and location.

If you have a file named Unit1/Form1 then it would indicate that you have a unit or form which hasn't been given a name, but it may still be used as part of your project. If it is used as part of your project then it is not safe to delete it. The only way to know if is used is to go through each of the uses clauses in your project, or to use an automated tool to do this for you.

Mike Sutton