fix disk.Partition cut off after first disk#1975
Conversation
using windows.UTF16ToString() converts a []uint16 to a string but ends after the first NUL.
There is already a split0() function which does the right thing in this file, so simply use
that one.
before:
getLogicalDrives() -> ['C:\']
after:
getLogicalDrives() -> ['C:\', 'D:\', 'Z:\']
Signed-off-by: Sven Nierlein <sven@consol.de>
|
@sni thank you so much for the fix, can you please add a test? |
|
There are tests in place and they failed on my machine before this fix. |
|
shirou
left a comment
There was a problem hiding this comment.
Since procGetLogicalDriveStringsW returns device-dependent values, it’s difficult to add tests. Could you share the value of lpBuffer on your local machine? That would help us add tests for split0.
Yeah, but it's possible for example to mount a folder as volume or simulate a virtual drive in the test. It would be nice to know the value and the cause of the problem reported by @sni |
Sure, bufferLen is set to: |
|
Thank you for the information! I can confirm that this PR fixes the issue. I’ll create another PR to add tests using virtual drives (possibly with |
using windows.UTF16ToString() converts a []uint16 to a string but ends after the first NUL. There is already a split0() function which does the right thing in this file, so simply use that one.
before:
after: