Typing this as `update.Updater | None` and having the check
`if self.updater is not None:` causes the menu entry to not even get added,
because `import update` was coming later.
I can't recall why that import/setup was later, but I might be about to find
out again....
Still produces the system/station:
`HIP 10792.Crimson Exchange.2022-12-30T16.22.39.json`
But now also the FC:
`FleetCarrier.X3F-N5Z.2022-12-30T16.24.01.json`
In testing the *first* hit on this does have `monitor.cmdr` set, but neither
`monitor.system` or `monitor.station`. So:
1. Allow those to be `None` in the function signature,
2. Guard against only `monitor.cmdr` being falsey before the call.
3. Move the `if err:` to the same scope.
* In trying to fix the return type 'exception' I first decided to properly
prototype GetMessageW().
* But it turns out that you just can't get rid of that exception, so I just
added a comment about it being harmless, because the functionality works
as intended anyway.
* I can't even get this code to be problematic, with a folder containing
unicode heart characters, on 64-bit Python 3.7.9 (Release/4.1.6 adjusted to
not set UTF-8 locale), let alone on 64-bit Python 3.11 and this branch.
So, just always use the tkinter dialog. Bye-bye ctypes code which I just
couldn't get to work under 64-bit Python.
* I *think* the issue with the ctypes code was that under 32-bit an 'int' and
a pointer are the same size.
'Raw' (not declaring types beforehand) the `SHBrowseForFolderW()` function
causes ctypes to consider it returns an int. This works on 32-bit.
But on 64-bit that int is still 32-bits, but pointers are 64-bit, so ctypes
ends up coercing/casting/truncating the returned pointer into an int,
which than can't even be cast back to a pointer.
Meanwhile, attempting to properly define the signature of the function
has only lead to it crashing on invocation, despite being passed the same
BROWSEINFOW structure, defined in the same manner. This might be a matter
of a type within it needing adjusting, but I was following the docs there.
1. `SHGetPathFromIDListW` needing fixing, which was achieved, but...
2. ... then `SHBrowseForFolderW()` as-was returned `int` instead of a pointer
to the correct structure.
Trying to fix 2 has proven intractable:
a. Trying to cast the `int` return just results in `exception: access violation
reading <address>`.
b. Trying to define `SHBrowseForFolderW` properly, so it returns the correct
type results in a *writing* access violation when called, despite passing
the exact same data in as for the 'raw' call version.
So, this commit is a record, and I'm next going to try switching to
`IFileDialog` as recommended by the docs for `SHBrowseForFolderW` ('For
Windows Vista or later').
Given this is the form of definition in the official Python docs I'm
wondering if this only ever worked on 32-bit by accident.
So, it was nothing to do with the type needing to be changed for 64-bit.
The error:
ctypes.ArgumentError: argument 4: <class 'OverflowError'>: int too long to convert
was a red herring in those terms.