Commit 47b38689 authored by Szabolcs Gyurko's avatar Szabolcs Gyurko
Browse files

Create job directory if does not exist

parent c845ee8d
package controllers
import java.io.File
import entities.{JobRecord, JobsTable, QueueRecord, QueueTable}
import javax.inject.Inject
import org.slf4j.LoggerFactory
......@@ -75,6 +77,11 @@ class AddJob @Inject() (val controllerComponents: ControllerComponents, protecte
var jobData = addJobData
if (jobData.pass.nonEmpty && jobData.pass.get == Defaults.PASSWORD_PLACEHOLDER)
jobData = addJobData.copy(pass = sget2.settings.getOrElse(Defaults.SETTING_PASSWORD, None))
val directory = new File(jobData.path)
if (!directory.exists()) {
directory.mkdirs()
}
val path = s"${jobData.path}${java.io.File.separator}${new java.net.URL(jobData.url).getFile.replaceAll(".*/([^/]+)$", "$1")}"
val jobRecord = JobRecord(0, jobData.url, path, jobData.maxBandwidth,
......
name := "sget2"
version := "1.3"
version := "1.3.1"
lazy val `sget2` = (project in file(".")).enablePlugins(PlayScala)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment