Skip to content

Commit

Permalink
Limit match save filename length
Browse files Browse the repository at this point in the history
  • Loading branch information
hstennes committed Jan 30, 2024
1 parent 732f392 commit c6d2716
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ task buildMaps(type: JavaExec, dependsOn: [':engine:build']) {

def defaultClassLocation = project(':example-bots').sourceSets.main.output.classesDirs.getAsPath()
def defaultReplay = 'matches/' + project.property('teamA') + '-vs-' + project.property('teamB') + '-on-' + project.property('maps') + new Date().format('yyyyMMddHHmmss') + '.bc24'
def saveFileName = (project.findProperty('replay') ?: defaultReplay)
saveFileName = saveFileName.substring(0, saveFileName.length() - 5)
saveFileName = saveFileName.substring(0, Math.min(saveFileName.length(), 100)) + '.bc24'

task headless(type: JavaExec, dependsOn: [':engine:build', ':example-bots:build']) {
mainClass = 'battlecode.server.Main'
Expand All @@ -74,7 +77,7 @@ task headless(type: JavaExec, dependsOn: [':engine:build', ':example-bots:build'
'-Dbc.game.maps=' + project.property('maps'),
'-Dbc.server.validate-maps=' + project.property('validateMaps'),
'-Dbc.server.alternate-order=' + project.property('alternateOrder'),
'-Dbc.server.save-file=' + (project.findProperty('replay') ?: defaultReplay),
'-Dbc.server.save-file=' + (saveFileName)
]
}

Expand Down

0 comments on commit c6d2716

Please sign in to comment.