From 0f308da4d0d51d2a9c5faf7b6a56500f7710ec00 Mon Sep 17 00:00:00 2001 From: bilditup1 Date: Thu, 16 Nov 2023 21:44:57 -0500 Subject: [PATCH] Support for >260 char filenames on Windows --- host/nxdt_host.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/host/nxdt_host.py b/host/nxdt_host.py index 2287e44..11c6dc5 100644 --- a/host/nxdt_host.py +++ b/host/nxdt_host.py @@ -787,6 +787,10 @@ def usbHandleSendFileProperties(cmd_block: bytes) -> int | None: # Generate full, absolute path to the destination file. fullpath = os.path.abspath(g_outputDir + os.path.sep + filename) + # Unconditionally enable 32-bit paths on Windows. + if g_isWindows: + fullpath = '\\\\?\\' + fullpath.replace("/", "\\") + # Get parent directory path. dirpath = os.path.dirname(fullpath) @@ -822,6 +826,11 @@ def usbHandleSendFileProperties(cmd_block: bytes) -> int | None: # Retrieve what we need using global variables. file = g_nspFile fullpath = g_nspFilePath + + # Unconditionally enable 32-bit paths on Windows. + if g_isWindows: + fullpath = '\\\\?\\' + fullpath.replace("/", "\\") + dirpath = os.path.dirname(fullpath) # Check if we're dealing with an empty file or with the first SendFileProperties command from a NSP.