From: Niki Roo Date: Thu, 20 Apr 2017 17:57:39 +0000 (+0200) Subject: Version 1.4.2: bugfixes (unhtml, deltree) X-Git-Tag: nikiroo-utils-1.4.2^0 X-Git-Url: http://git.nikiroo.be/?p=nikiroo-utils.git;a=commitdiff_plain;h=7ee9568bee3caddfb837007dda09460acc145177 Version 1.4.2: bugfixes (unhtml, deltree) --- diff --git a/VERSION b/VERSION index 347f583..9df886c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.4.1 +1.4.2 diff --git a/changelog b/changelog index 3cc63ad..e0bb0a4 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,12 @@ +Version 1.4.2 +------------- + +Bugfix: Deltree + Deltree was not OK for files... + +Bugfix: unhtml + Also replace non-breakable spaces by normal spaces + Version 1.4.1 ------------- diff --git a/src/be/nikiroo/utils/IOUtils.java b/src/be/nikiroo/utils/IOUtils.java index eb105e2..4a185c6 100644 --- a/src/be/nikiroo/utils/IOUtils.java +++ b/src/be/nikiroo/utils/IOUtils.java @@ -202,20 +202,15 @@ public class IOUtils { * the target to delete */ public static void deltree(File target) { - for (File file : target.listFiles()) { - if (file.isDirectory()) { + File[] files = target.listFiles(); + if (files != null) { + for (File file : files) { deltree(file); - } else { - if (!file.delete()) { - System.err.println("Cannot delete file: " - + file.getAbsolutePath()); - } } } if (!target.delete()) { - System.err.println("Cannot delete file: " - + target.getAbsolutePath()); + System.err.println("Cannot delete: " + target.getAbsolutePath()); } } diff --git a/src/be/nikiroo/utils/StringUtils.java b/src/be/nikiroo/utils/StringUtils.java index cd9a463..adebd7a 100644 --- a/src/be/nikiroo/utils/StringUtils.java +++ b/src/be/nikiroo/utils/StringUtils.java @@ -325,7 +325,9 @@ public class StringUtils { } } - return HtmlEscape.unescapeHtml(builder.toString()); + char nbsp = ' '; // non-breakable space (a special char) + char space = ' '; + return HtmlEscape.unescapeHtml(builder.toString()).replace(nbsp, space); } /**