From 6b621efef27bf73ef763bc49c7e91ebc5e82cb73 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Sun, 10 Jan 2021 10:48:49 -0500 Subject: [PATCH] Turns out there is also CommandLineToArgv just not CommandLineToArgvW, but that's fine. --- src/allmydata/windows/fixups.py | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/src/allmydata/windows/fixups.py b/src/allmydata/windows/fixups.py index 2cdb1ad93..9fb81bdff 100644 --- a/src/allmydata/windows/fixups.py +++ b/src/allmydata/windows/fixups.py @@ -13,30 +13,12 @@ def get_argv(): shape. """ # - from win32ui import ( + from win32api import ( GetCommandLine, + CommandLineToArgv, ) + return CommandLineToArgv(GetCommandLine()) - from ctypes import WINFUNCTYPE, WinError, windll, POINTER, byref, c_int, get_last_error - from ctypes.wintypes import LPWSTR, LPCWSTR - - # - CommandLineToArgvW = WINFUNCTYPE( - POINTER(LPWSTR), LPCWSTR, POINTER(c_int), - use_last_error=True - )(("CommandLineToArgvW", windll.shell32)) - - argc = c_int(0) - argv_unicode = CommandLineToArgvW(GetCommandLine(), byref(argc)) - if argv_unicode is None: - raise WinError(get_last_error()) - - # Convert it to a normal Python list - return list( - argv_unicode[i] - for i - in range(argc.value) - ) def initialize():