Commit 19b39a3e by Amelin Konstantin

Rename notValidated and error dirs after converting

parent 44be4a66
...@@ -49,15 +49,15 @@ object Main { ...@@ -49,15 +49,15 @@ object Main {
val sourceNameValidated = s"${args(0)}/${start}_validated" val sourceNameValidated = s"${args(0)}/${start}_validated"
val sourceValidated = Try { Files.createDirectory(Paths.get(sourceNameValidated)) } val sourceValidated = Try { Files.createDirectory(Paths.get(sourceNameValidated)) }
val sourceNameNotValidated = s"${args(0)}/${start}_not_validated" val sourceNameNotValidated = s"${args(0)}/${start}_temp_nv"
val sourceNotValidated = Try { Files.createDirectory(Paths.get(sourceNameNotValidated)) } val sourceNotValidated = Try { Files.createDirectory(Paths.get(sourceNameNotValidated)) }
val sourceNameError = s"${args(0)}/error_$start" val sourceNameError = s"${args(0)}/temp_e_$start"
val sourceError = Try { Files.createDirectory(Paths.get(sourceNameError)) } val sourceError = Try { Files.createDirectory(Paths.get(sourceNameError)) }
val createDirRes = for { val createDirRes = for {
sv <- sourceValidated _ <- sourceValidated
snv <- sourceNotValidated _ <- sourceNotValidated
se <- sourceError se <- sourceError
} yield se } yield se
...@@ -196,7 +196,17 @@ object Main { ...@@ -196,7 +196,17 @@ object Main {
Files.delete(sourceValidated.get) Files.delete(sourceValidated.get)
if (Files.list(sourceNotValidated.get).iterator.asScala.isEmpty) Files.delete(sourceNotValidated.get) if (Files.list(sourceNotValidated.get).iterator.asScala.isEmpty) Files.delete(sourceNotValidated.get)
else {
val sourceNameNotValidatedFinal = s"${args(0)}/${start}_not_validated"
Files.move(sourceNotValidated.get, Paths.get(sourceNameNotValidatedFinal))
}
if (Files.list(sourceError.get).iterator.asScala.isEmpty) Files.delete(sourceError.get) if (Files.list(sourceError.get).iterator.asScala.isEmpty) Files.delete(sourceError.get)
else {
val sourceNameErrorFinal = s"${args(0)}/error_$start"
Files.move(sourceError.get, Paths.get(sourceNameErrorFinal))
}
} match { } match {
case Success(_) => println(s"Converting has been finished. $logFileName located in ${args(0)}") case Success(_) => println(s"Converting has been finished. $logFileName located in ${args(0)}")
...@@ -212,7 +222,7 @@ object Main { ...@@ -212,7 +222,7 @@ object Main {
implicit def templateFactory(source: Node): Template = { implicit def templateFactory(source: Node): Template = {
Try { (source \\ "trade").head.child Try { (source \\ "trade").head.child
.filter { .filter {
case v: Elem => true case _: Elem => true
case _ => false case _ => false
}(1).label } match { }(1).label } match {
case Success(v) if v == "repo" => case Success(v) if v == "repo" =>
......
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