DOH!
I meant the compiler does 'not' cause the same error - just the
Eclipse IDE
Here is some more context. I am using Scala 2.9.1
Cheers, Eric
---- Run.scala ----
package com.kodak.intersystem.scripts
import com.kodak.intersystem.common.OperatingSystemFamily
import com.kodak.intersystem.common.Properties
import com.kodak.intersystem.common.Property
import com.kodak.intersystem.common.TimeStamp
import java.io.File
import org.slf4j.Logger
import scala.sys.process.Process
import scala.sys.process.ProcessLogger
/**
* Create a new O/S process and run it. For example
* {{{
* Run(List("command", "arg1", "arg2) match {
* case RunResult(process, outString, errString) =>
* // handle the normal case
* case ErrorResult(process, outString, errString) =>
* // handle the exception case
* }
* }}}
*
* @author Eric Kolotyluk
* @see <a href=
"http://www.scala-lang.org/">Scala
home</a>
* @see <a
href=
"http://www.codecommit.com/scala-style-guide.pdf">Style
Guide</a>
*/
object Run extends Emitter {
val properties = Properties.getScriptProperties(); // must call
before getLogger() - EK
override lazy val logger = Properties.getLogger(getClass())
def apply(command:List[String], workingDirectory:Option[File] =
None) : RunResult = {
logger.info(command.foldLeft("run:") {(string, argument) =>
string + " " + argument})
val outBuilder = new StringBuilder()
val errBuilder = new StringBuilder()
val processLogger = ProcessLogger(
(outLine: String) =>
outBuilder.append(outLine).append("\n"),
(errLine: String) =>
errBuilder.append(errLine).append("\n"))
val processBuilder = Process(command, workingDirectory)
val process = processBuilder.run(processLogger, false)
if (process.exitValue() == 0)
NormalResult(process, outBuilder.toString(),
errBuilder.toString())
else
ErrorResult(process, outBuilder.toString(),
errBuilder.toString())
}
}
abstract class RunResult
case class NormalResult(process:Process, outString:String,
errString:String) extends RunResult
case class ErrorResult(process:Process, outString:String,
errString:String) extends RunResult
---- Archive.scala ----
package com.kodak.intersystem.scripts
import com.kodak.intersystem.common.OperatingSystemFamily
import com.kodak.intersystem.common.Properties
import com.kodak.intersystem.common.Property
import com.kodak.intersystem.common.TimeStamp
import java.io.File
import java.util.Calendar
import org.slf4j.Logger
import scala.sys
import scala.sys.env
import scala.sys.process.Process
/**
* Create an archive and add contents to it. For example
* {{{
* Archive(content)
* }}}
* or
* {{{
* Archive(List(content1, content2, ...))
* }}}
*
* @author Eric Kolotyluk
* @see <a href=
"http://www.scala-lang.org/">Scala
home</a>
* @see <a
href=
"http://www.codecommit.com/scala-style-guide.pdf">Style
Guide</a>
*/
object Archive extends Emitter {
val properties = Properties.getScriptProperties(); // must call
before getLogger() - EK
override lazy val logger = Properties.getLogger(getClass())
val homeDirectory = Property.INTERSYSTEM_HOME.getFile()
val archiveDirectory = new File(homeDirectory + File.separator +
"archive")
def apply(content:String) : Unit = apply(List(content))
def apply(contents:List[String]) = {
// Setting up the 7z command is a little tricky to get things to
where you want them to go,
// and how you want them to go. We set up the working directory
so that when 7z builds the
// folder structure in the archive, it will start with the
Intersystem folder. The path names
// of the archive file and directory to be added to the archive
must be relative to the
// working directory. EK
val workingDirctory = homeDirectory.getParentFile()
val archivePath = "Intersystem" + File.separator + "archive" +
File.separator +
TimeStamp.toString(TimeStamp.getCurrentUTC()).replace(':','-') +
".7z"
emit("creating archive " + archivePath)
val zipCommand = List("7z", "a", "-mx", archivePath)