mirror of
https://gitee.com/dcren/initializr.git
synced 2025-07-15 23:13:30 +08:00
template should load with utf-8 and save with utf-8
This commit is contained in:
parent
e6ad78a510
commit
a3a05000b0
@ -408,7 +408,7 @@ class ProjectGenerator {
|
|||||||
def write(File target, String templateName, def model) {
|
def write(File target, String templateName, def model) {
|
||||||
def tmpl = templateName.endsWith('.groovy') ? templateName + '.tmpl' : templateName
|
def tmpl = templateName.endsWith('.groovy') ? templateName + '.tmpl' : templateName
|
||||||
def body = groovyTemplate.process tmpl, model
|
def body = groovyTemplate.process tmpl, model
|
||||||
target.write(body)
|
target.write(body, 'utf-8')
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addTempFile(String group, File file) {
|
private void addTempFile(String group, File file) {
|
||||||
|
@ -70,7 +70,7 @@ class GroovyTemplate {
|
|||||||
def classLoader = GroovyTemplate.class.classLoader
|
def classLoader = GroovyTemplate.class.classLoader
|
||||||
def resource = classLoader.getResource("templates/" + name)
|
def resource = classLoader.getResource("templates/" + name)
|
||||||
if (resource) {
|
if (resource) {
|
||||||
return engine.createTemplate(resource)
|
return engine.createTemplate(resource.getText('utf-8'))
|
||||||
}
|
}
|
||||||
|
|
||||||
return engine.createTemplate(name)
|
return engine.createTemplate(name)
|
||||||
|
Loading…
Reference in New Issue
Block a user