diff options
author | Christian Stenger <christian.stenger@qt.io> | 2019-06-25 09:27:31 +0200 |
---|---|---|
committer | Christian Stenger <christian.stenger@qt.io> | 2019-06-27 07:18:19 +0000 |
commit | 6288e03264129ff6e57211bf86d7ff7b98d95726 (patch) | |
tree | 91c9967a2c302f9ad68dc7fb010d8ff1e23a5711 /share/qtcreator/templates | |
parent | 33d49ec07248b729932632dd6b7c2336a77e5839 (diff) |
Wizards: Fix regular expressions
Although this is valid JavaScript matching the '.' is
not working as expected.
The directory always gets messed up by replacing the
first character with a dash. Use an alternate regular
expression and also ensure the replacement happens
globally instead of once as we want to replace all
dots by a dash.
As at it fix handling of the file suffixes as well.
Task-number: QTCREATORBUG-22625
Change-Id: Ide189fe50e29994abfb368e503050b9b413aba9f
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'share/qtcreator/templates')
5 files changed, 7 insertions, 7 deletions
diff --git a/share/qtcreator/templates/wizards/files/java/wizard.json b/share/qtcreator/templates/wizards/files/java/wizard.json index 6341319c6b..5a8fae5dc1 100644 --- a/share/qtcreator/templates/wizards/files/java/wizard.json +++ b/share/qtcreator/templates/wizards/files/java/wizard.json @@ -9,7 +9,7 @@ "iconText": "java", "enabled": "%{JS: value('Plugins').indexOf('Android') >= 0}", - "options": [ { "key": "ClassName", "value": "%{JS: value('FileName').charAt(0).toUpperCase() + value('FileName').substr(1).replace(/\\.java$/,'')}" } ], + "options": [ { "key": "ClassName", "value": "%{JS: value('FileName').charAt(0).toUpperCase() + value('FileName').substr(1).replace(/[.]java$/,'')}" } ], "pages" : [ diff --git a/share/qtcreator/templates/wizards/projects/vcs/bazaar/wizard.json b/share/qtcreator/templates/wizards/projects/vcs/bazaar/wizard.json index a8b4d041e7..f81509c4ed 100644 --- a/share/qtcreator/templates/wizards/projects/vcs/bazaar/wizard.json +++ b/share/qtcreator/templates/wizards/projects/vcs/bazaar/wizard.json @@ -14,7 +14,7 @@ { "key": "vcsId", "value": "B.Bazaar" }, { "key": "vcsName", "value": "%{JS: Vcs.displayName('%{vcsId}')}" }, { "key": "SR", "value": "%{JS: '%{Repo}'.substr('%{Repo}'.indexOf(':') + 1) }" }, - { "key": "defaultDir", "value": "%{JS: '%{SR}'.substr('%{SR}'.lastIndexOf('/') + 1).replace(/\\./, '-') }"}, + { "key": "defaultDir", "value": "%{JS: '%{SR}'.substr('%{SR}'.lastIndexOf('/') + 1).replace(/[.]/g, '-') }"}, { "key": "RevArg", "value": "%{JS: '%{Rev}' !== '' ? '-r' : ''}" }, { "key": "TargetPath", "value": "%{Path}/%{Dir}" } ], diff --git a/share/qtcreator/templates/wizards/projects/vcs/git/wizard.json b/share/qtcreator/templates/wizards/projects/vcs/git/wizard.json index c97698612b..0295468f6f 100644 --- a/share/qtcreator/templates/wizards/projects/vcs/git/wizard.json +++ b/share/qtcreator/templates/wizards/projects/vcs/git/wizard.json @@ -13,8 +13,8 @@ [ { "key": "vcsId", "value": "G.Git" }, { "key": "vcsName", "value": "%{JS: Vcs.displayName('%{vcsId}')}" }, - { "key": "SR", "value": "%{JS: '%{Repo}'.replace(/\\.git$/, '') }"}, - { "key": "defaultDir", "value": "%{JS: '%{SR}'.substr('%{SR}'.lastIndexOf('/') + 1).replace(/\\./, '-') }"}, + { "key": "SR", "value": "%{JS: '%{Repo}'.replace(/[.]git$/, '') }"}, + { "key": "defaultDir", "value": "%{JS: '%{SR}'.substr('%{SR}'.lastIndexOf('/') + 1).replace(/[.]/g, '-') }"}, { "key": "branchArg", "value": "%{JS: '%{Branch}' ? '--branch' : '' }" }, { "key": "TargetPath", "value": "%{Path}/%{Dir}" } ], diff --git a/share/qtcreator/templates/wizards/projects/vcs/mercurial/wizard.json b/share/qtcreator/templates/wizards/projects/vcs/mercurial/wizard.json index 75bd410861..8e655e1eb6 100644 --- a/share/qtcreator/templates/wizards/projects/vcs/mercurial/wizard.json +++ b/share/qtcreator/templates/wizards/projects/vcs/mercurial/wizard.json @@ -14,7 +14,7 @@ { "key": "vcsId", "value": "H.Mercurial" }, { "key": "vcsName", "value": "%{JS: Vcs.displayName('%{vcsId}')}" }, { "key": "SR", "value": "%{JS: '%{Repo}'.substr('%{Repo}'.indexOf(':') + 1) }"}, - { "key": "defaultDir", "value": "%{JS: '%{SR}'.substr('%{SR}'.lastIndexOf('/') + 1).replace(/\\./, '-') }"}, + { "key": "defaultDir", "value": "%{JS: '%{SR}'.substr('%{SR}'.lastIndexOf('/') + 1).replace(/[.]/g, '-') }"}, { "key": "TargetPath", "value": "%{Path}/%{Dir}" } ], diff --git a/share/qtcreator/templates/wizards/projects/vcs/subversion/wizard.json b/share/qtcreator/templates/wizards/projects/vcs/subversion/wizard.json index aef8a28b9a..cfeddbb532 100644 --- a/share/qtcreator/templates/wizards/projects/vcs/subversion/wizard.json +++ b/share/qtcreator/templates/wizards/projects/vcs/subversion/wizard.json @@ -13,8 +13,8 @@ [ { "key": "vcsId", "value": "J.Subversion" }, { "key": "vcsName", "value": "%{JS: Vcs.displayName('%{vcsId}')}" }, - { "key": "SR", "value": "%{JS: '%{Repo}'.replace(/\\/trunk$/, '').replace(/\\/$/, '') }"}, - { "key": "defaultDir", "value": "%{JS: '%{SR}'.substr('%{SR}'.lastIndexOf('/') + 1).replace(/\\./, '-') }"}, + { "key": "SR", "value": "%{JS: '%{Repo}'.replace(/[/]trunk$/, '').replace(/[/]$/, '') }"}, + { "key": "defaultDir", "value": "%{JS: '%{SR}'.substr('%{SR}'.lastIndexOf('/') + 1).replace(/[.]/g, '-') }"}, { "key": "TargetPath", "value": "%{Path}/%{Dir}" } ], |