Bug 76800 - variables are replaced in source file templates
Summary: variables are replaced in source file templates
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: file create (show other bugs)
Version: 3.0.1
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: KDevelop Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-05 09:19 UTC by Georg Baum
Modified: 2005-01-07 20:19 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Georg Baum 2004-03-05 09:19:59 UTC
Version:           3.0.1 (using KDE 3.1.1)
Installed from:    SuSE
Compiler:          gcc version 3.3 20030226 (prerelease) (SuSE Linux)
OS:          Linux (i686) release 2.4.20-4GB-athlon

Create a new project (in my case qmake hello world, but I guess this is independent of the type). When the wizard presents the .h and .cpp templates, enter some variables: $MODULE$, $AUTHOR$ and $YEAR$ in my case. Finish the new project. Then look at the generated templates: $MODULE$ is still there, but $AUTHOR$ and $YEAR$ are replaced by my name and the current year.
This is wrong: All variables should be replaced when a new file is created from the template, and not when the template is created. After all, this is the purpose of the variables, and you can't know in advance when a new file will be created, nor in a multi developer project who will do this.
Comment 1 Georg Baum 2004-03-05 09:43:18 UTC
I just noticed: The generated helloworld.cpp file does contain the variables, not the substituted values. So it seems they are replaced in the wrong file ;-( Also I used  a CVS $Id:$ tag in the template. Maybe this confused kdevelop?
Comment 2 Jens Dagerbo 2005-01-03 07:17:33 UTC
I must misunderstand something, from what I can tell, what you describe works fine.

Any of $EMAIL$, $AUTHOR$, $VERSION$, $DATE$, $YEAR$, $MODULE$ and $FILENAME$ that you add to the template(s) presented in the project creation wizard will be replaced by the respective values _when you create a new file_ using File->New. That is, when a user wants a new file, which as you say could well be B. Gates in 2019.

What does not work correctly, is that any variables you add in the wizard will not be substituted in the files created from the _project_ template. This is  a bug.
Comment 3 Jens Dagerbo 2005-01-07 20:19:42 UTC
CVS commit by dagerbo: 

Bug galore!

BUG: 90070
BUG: 76800
BUG: 83191
BUG: 88229
BUG: 89149


  M +29 -5     appwizarddlg.cpp   1.112
  M +3 -3      kdevlicense.cpp   1.3