From a0e9a5f92557579e9c233f0045c94d7dcce0a9a9 Mon Sep 17 00:00:00 2001 From: Mohamed EZ-ZARGHILI Date: Fri, 1 May 2015 02:42:22 +0100 Subject: [PATCH 1/4] fix #21 --- .../scala/com/typesafe/sbt/packager/windows/WixHelper.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/scala/com/typesafe/sbt/packager/windows/WixHelper.scala b/src/main/scala/com/typesafe/sbt/packager/windows/WixHelper.scala index 89f29ea1c..4a15bfa51 100644 --- a/src/main/scala/com/typesafe/sbt/packager/windows/WixHelper.scala +++ b/src/main/scala/com/typesafe/sbt/packager/windows/WixHelper.scala @@ -130,16 +130,18 @@ object WixHelper { // Also, we need some mechanism to ensure the start menu folder is removed in the event // that we remove all menu items. case AddShortCuts(targets, workingDir) => - val id = cleanStringForId("shortcut_" + makeGUID).takeRight(67) // Room for "_SC" + val id = cleanStringForId("shortcut_" + makeGUID).takeRight(70 - targets.size.toString().size - 3) // Room for "_SC"+incremental number val xml = { + var i = 0 for (target <- targets) yield { + i = i + 1 val name = simpleName(target) val desc = "Edit configuration file: " + name val cleanName = name.replaceAll("[\\.-\\\\//]+", "_") - + } } From d03de942427d8a0037187d1efaac9069034fd57d Mon Sep 17 00:00:00 2001 From: Mohamed EZ-ZARGHILI Date: Fri, 1 May 2015 02:52:27 +0100 Subject: [PATCH 2/4] small maths --- .../scala/com/typesafe/sbt/packager/windows/WixHelper.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/com/typesafe/sbt/packager/windows/WixHelper.scala b/src/main/scala/com/typesafe/sbt/packager/windows/WixHelper.scala index 4a15bfa51..c5ab09d9f 100644 --- a/src/main/scala/com/typesafe/sbt/packager/windows/WixHelper.scala +++ b/src/main/scala/com/typesafe/sbt/packager/windows/WixHelper.scala @@ -130,7 +130,7 @@ object WixHelper { // Also, we need some mechanism to ensure the start menu folder is removed in the event // that we remove all menu items. case AddShortCuts(targets, workingDir) => - val id = cleanStringForId("shortcut_" + makeGUID).takeRight(70 - targets.size.toString().size - 3) // Room for "_SC"+incremental number + val id = cleanStringForId("shortcut_" + makeGUID).takeRight(67 - targets.size.toString().size) // Room for "_SC"+incremental number val xml = From ee8643fc9f3b93458520ec287d699a67b84c23d1 Mon Sep 17 00:00:00 2001 From: Mohamed EZ-ZARGHILI Date: Fri, 1 May 2015 11:46:43 +0100 Subject: [PATCH 3/4] cleaned up code --- .../scala/com/typesafe/sbt/packager/windows/WixHelper.scala | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/scala/com/typesafe/sbt/packager/windows/WixHelper.scala b/src/main/scala/com/typesafe/sbt/packager/windows/WixHelper.scala index c5ab09d9f..11e8b861b 100644 --- a/src/main/scala/com/typesafe/sbt/packager/windows/WixHelper.scala +++ b/src/main/scala/com/typesafe/sbt/packager/windows/WixHelper.scala @@ -135,13 +135,11 @@ object WixHelper { { - var i = 0 - for (target <- targets) yield { - i = i + 1 + for ((target, i) <- targets.zipWithIndex) yield { val name = simpleName(target) val desc = "Edit configuration file: " + name val cleanName = name.replaceAll("[\\.-\\\\//]+", "_") - + } } From 00fd9e2386c00ffb6422991a13b23b02e3c2cc40 Mon Sep 17 00:00:00 2001 From: Mohamed EZ-ZARGHILI Date: Fri, 1 May 2015 11:50:27 +0100 Subject: [PATCH 4/4] moved fixed number size to reusable variable --- .../scala/com/typesafe/sbt/packager/windows/WixHelper.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/scala/com/typesafe/sbt/packager/windows/WixHelper.scala b/src/main/scala/com/typesafe/sbt/packager/windows/WixHelper.scala index 11e8b861b..703439037 100644 --- a/src/main/scala/com/typesafe/sbt/packager/windows/WixHelper.scala +++ b/src/main/scala/com/typesafe/sbt/packager/windows/WixHelper.scala @@ -130,7 +130,8 @@ object WixHelper { // Also, we need some mechanism to ensure the start menu folder is removed in the event // that we remove all menu items. case AddShortCuts(targets, workingDir) => - val id = cleanStringForId("shortcut_" + makeGUID).takeRight(67 - targets.size.toString().size) // Room for "_SC"+incremental number + val targetSize = targets.size.toString.size + val id = cleanStringForId("shortcut_" + makeGUID).takeRight(67 - targetSize) // Room for "_SC"+incremental number val xml = @@ -139,7 +140,7 @@ object WixHelper { val name = simpleName(target) val desc = "Edit configuration file: " + name val cleanName = name.replaceAll("[\\.-\\\\//]+", "_") - + } }