16 lines
499 B
Groovy
16 lines
499 B
Groovy
|
|
def lineendings = load("${autobuilder.commonscripts()}/platform/lineendings.groovy")
|
|
|
|
// Get current contents of given file and optionally add a newline string/character; If file doesn't exist, return default contents
|
|
def currentContents(file, newline = "${nl}", defaultContents = "") {
|
|
def contents = ""
|
|
if (fileExists("${file}")) {
|
|
contents = readFile(file: "${file}").trim() + newline
|
|
}
|
|
else {
|
|
contents = defaultContents
|
|
}
|
|
return contents
|
|
}
|
|
|
|
return this;
|