From 06be73db2299bf580cfc4197099bce8547472825 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Tue, 27 Feb 2018 19:31:58 -0800 Subject: [PATCH] split.c: fix finding extension of first split WIM part Silly old bug: wimlib_split() considered the first dot in the SWM path to begin the filename extension. But of course, there can be other dots in the path; we need to look for the last dot in the last component. --- NEWS | 3 +++ src/split.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index a2e812f4..5213d672 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,9 @@ Version 1.13.0-BETA: existing integrity tables. This can be useful to avoid unwanted verification of large WIM files, e.g. WIMs given by '--delta-from'. + wimsplit (API: wimlib_split()) now correctly handles a dot in the path + to the first split WIM part, prior to the filename extension. + 'wimlib-imagex --version' now shows the version of the library it is actually using (in case it is different from wimlib-imagex's version). diff --git a/src/split.c b/src/split.c index 795fb2cf..1313a59a 100644 --- a/src/split.c +++ b/src/split.c @@ -31,6 +31,7 @@ #include "wimlib/error.h" #include "wimlib/list.h" #include "wimlib/metadata.h" +#include "wimlib/paths.h" #include "wimlib/progress.h" #include "wimlib/resource.h" #include "wimlib/wim.h" @@ -74,7 +75,7 @@ write_split_wim(WIMStruct *orig_wim, const tchar *swm_name, swm_name_len = tstrlen(swm_name); swm_name_buf = alloca((swm_name_len + 20) * sizeof(tchar)); tstrcpy(swm_name_buf, swm_name); - dot = tstrchr(swm_name_buf, T('.')); + dot = tstrrchr(path_basename(swm_name_buf), T('.')); if (dot) { swm_base_name_len = dot - swm_name_buf; swm_suffix = alloca((tstrlen(dot) + 1) * sizeof(tchar)); -- 2.43.0