Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Substitution for $package$ in directory name doesn't work for Windows #42

Open
kwalcock opened this issue Aug 9, 2021 · 0 comments
Open

Comments

@kwalcock
Copy link

kwalcock commented Aug 9, 2021

I'm trying to use functionality described at http://www.foundweekends.org/giter8/template.html in which a directory is named $package$. It seems to work for Linux, but it doesn't for Windows. It may be that backslashes get into the path and are misinterpreted as escape characters. Here are the steps, approximately:

> sbt new foundweekends/giter8.g8
> cd my-template-project
> cd src/main/g8
> cd src/main
> mkdir resources
> mkdir resources/$package$ # do this from the gui
> cp scala/Stub.scala resources/$package$ # do this from the gui
> cd ../..
# Add "package = one.two.three" to default.properties
> cd ../../..
> sbt
sbt:My Template Project> g8

[error] stack trace is suppressed; run last Compile / g8 for the full output
[error] (Compile / g8) org.stringtemplate.v4.compiler.STException: relative: src\main\resources\$package$\Stub.scala, toPath: D:\Users\kwa\Documents\MyData\Projects\my-template-project\target\g8, An unexpected error occurred while processing the template. Check that all literal '$' are properly escaped with '\$'
[error] Total time: 0 s, completed Aug 9, 2021 11:08:11 AM

[error] org.stringtemplate.v4.compiler.STException: relative: src\main\resources\$package$\Stub.scala, toPath: D:\Users\kwa\Documents\MyData\Projects\my-template-project\target\g8, An unexpected error occurred while processing the template. Check that all literal '$' are properly escaped with '\$'
[error]         at giter8.G8$.expandPath(g8.scala:229)
[error]         at giter8.G8$.$anonfun$apply$2(g8.scala:99)
[error]         at scala.collection.TraversableLike.$anonfun$flatMap$1(TraversableLike.scala:293)
[error]         at scala.collection.Iterator.foreach(Iterator.scala:943)
[error]         at scala.collection.Iterator.foreach$(Iterator.scala:943)
[error]         at scala.collection.AbstractIterator.foreach(Iterator.scala:1431)
[error]         at scala.collection.IterableLike.foreach(IterableLike.scala:74)
[error]         at scala.collection.IterableLike.foreach$(IterableLike.scala:73)
[error]         at scala.collection.AbstractIterable.foreach(Iterable.scala:56)
[error]         at scala.collection.TraversableLike.flatMap(TraversableLike.scala:293)
[error]         at scala.collection.TraversableLike.flatMap$(TraversableLike.scala:290)
[error]         at scala.collection.AbstractTraversable.flatMap(Traversable.scala:108)
[error]         at giter8.G8$.apply(g8.scala:97)
[error]         at giter8.Giter8Plugin$.$anonfun$baseGiter8Settings$1(Giter8Plugin.scala:56)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error]         at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error]         at sbt.Execute.work(Execute.scala:291)
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error]         at java.lang.Thread.run(Thread.java:748)
[error] (Compile / g8) org.stringtemplate.v4.compiler.STException: relative: src\main\resources\$package$\Stub.scala, toPath: D:\Users\kwa\Documents\MyData\Projects\my-template-project\target\g8, An unexpected error occurred while processing the template. Check that all literal '$' are properly escaped with '\$'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant