@@ -4,7 +4,7 @@ import java.net.URLClassLoader
44import java .io .{BufferedInputStream , File , FileInputStream }
55import java .util .Properties
66import java .lang .reflect .InvocationTargetException
7- import java .nio .file .Files
7+ import java .nio .file .{ Files , StandardCopyOption }
88
99object LauncherMain extends Runner with App {
1010 java.util.logging.Logger .getLogger(" " ).setLevel(java.util.logging.Level .SEVERE )
@@ -35,7 +35,7 @@ class LauncherProcessor extends Processor {
3535 (if (forceOverwrite) Vector (" -f" ) else Vector ()) ++
3636 (outputDirectory match { case Some (out) => Vector (" -o" , out.toString); case _ => Vector () })
3737 val giter8Files = giter8Artifacts(g8v)
38- virtuallyRun(giter8Files, virtualArgument)
38+ virtuallyRun(giter8Files, virtualArgument, workingDirectory )
3939 Right (" " )
4040 }
4141
@@ -67,7 +67,7 @@ class LauncherProcessor extends Processor {
6767 }
6868 downloadedJars map { downloaded =>
6969 val t = bootDir / downloaded.getName
70- Files .copy(downloaded.toPath, t.toPath).toFile
70+ Files .copy(downloaded.toPath, t.toPath, StandardCopyOption . REPLACE_EXISTING ).toFile
7171 }
7272 }
7373 // push launcher JAR to the end of classpath to avoid Scala version clash
@@ -83,9 +83,9 @@ class LauncherProcessor extends Processor {
8383 }
8484
8585 // uses classloader trick to run
86- def virtuallyRun (files : Seq [File ], args : Seq [String ]): Unit = {
86+ def virtuallyRun (files : Seq [File ], args : Seq [String ], workingDirectory : File ): Unit = {
8787 val cl = new URLClassLoader (files.map(_.toURL).toArray, null )
88- call(" giter8.Giter8" , " run" , cl)(classOf [Array [String ]])(args.toArray)
88+ call(" giter8.Giter8" , " run" , cl)(classOf [Array [String ]], classOf [ File ] )(args.toArray, workingDirectory )
8989 }
9090
9191 def giter8Version (templateDir : File ): Option [String ] = {
0 commit comments