From 695860a3aabf1a662cf1868385bd17f338deaf53 Mon Sep 17 00:00:00 2001 From: thrust26 Date: Tue, 5 Jan 2021 10:04:12 +0100 Subject: [PATCH] attempted to fix special char problems in Windows (see #751) --- src/windows/FSNodeWINDOWS.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/windows/FSNodeWINDOWS.cxx b/src/windows/FSNodeWINDOWS.cxx index bc4212ddd..1c8880272 100644 --- a/src/windows/FSNodeWINDOWS.cxx +++ b/src/windows/FSNodeWINDOWS.cxx @@ -93,8 +93,13 @@ void FilesystemNodeWINDOWS::addFile(AbstractFSList& list, ListMode mode, { FilesystemNodeWINDOWS entry; char* asciiName = toAscii(find_data->cFileName); + // Use short 8.3 name for the path to handle special chars + char* shortAsciiName = toAscii(find_data->cAlternateFileName); bool isDirectory, isFile; + if(!strlen(shortAsciiName)) + shortAsciiName = asciiName; + // Skip local directory (.) and parent (..) if(!strncmp(asciiName, ".", 1) || !strncmp(asciiName, "..", 2)) return; @@ -110,7 +115,7 @@ void FilesystemNodeWINDOWS::addFile(AbstractFSList& list, ListMode mode, entry._isFile = isFile; entry._displayName = asciiName; entry._path = base; - entry._path += asciiName; + entry._path += shortAsciiName; if(entry._isDirectory) entry._path += "\\"; entry._isValid = true;