-
Notifications
You must be signed in to change notification settings - Fork 446
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
Wip/issue 21 multiple config files shortcuts #569
Wip/issue 21 multiple config files shortcuts #569
Conversation
val xml = | ||
<DirectoryRef Id="ApplicationProgramsFolder"> | ||
<Component Id={ id } Guid={ makeGUID }> | ||
{ | ||
var i = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue found: Avoid mutable local variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you need an index use
for( (target, i) <- targets.zipWithIndex) yield { ... }
val name = simpleName(target) | ||
val desc = "Edit configuration file: " + name | ||
val cleanName = name.replaceAll("[\\.-\\\\//]+", "_") | ||
<Shortcut Id={ id + "_SC" } Name={ cleanName } Description={ desc } Target={ "[INSTALLDIR]\\" + target.replaceAll("\\/", "\\\\") } WorkingDirectory="INSTALLDIR"/> | ||
<Shortcut Id={ id + "_SC" + ("%0" + targets.size.toString().size + "d").format(i) } Name={ cleanName } Description={ desc } Target={ "[INSTALLDIR]\\" + target.replaceAll("\\/", "\\\\") } WorkingDirectory="INSTALLDIR"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With scala 2.10
we can use string interpolation
s"$i${targets.size.toString.size}d")
If I get this correctly, the shortcuts are generated based on the number of targets available.
If yes, you can put the Otherwise this LGTM |
Thanks for the reviews, actually I am not familiar with scala that was really helpful,
and for 100 targets
|
…files_shortcuts Wip/issue 21 multiple config files shortcuts
This fixes issue with multiple shortcuts when having multiple config files,tested with a play application using several config files.