rnpgp / rnp

RNP: high performance C++ OpenPGP library used by Mozilla Thunderbird
https://www.rnpgp.org
Other
192 stars 54 forks source link

Incorrect user home folder on Windows #2149

Open maxirmx opened 8 months ago

maxirmx commented 8 months ago

Description

Incorrect user home folder on Windows

Expected Behavior

When Windows native environment (not MSys, not cygwin) is used user home folder is defined by USERPROFILE environment variable

Actual Behavior

rnp and rnp tests always use HOME

Practically it means that:

  1. rnp cli tests (Python tests) can be executed in MSys environment only because gpg follows HOME/USERPROFILE convention and thus is not compatible with RNP
  2. when rnp is executed in native Windows environment it creates key rings not in user home folder but elsewhere (empty string is used as HOME which probably means current folder -- may be wrong)
antonsviridenko commented 8 months ago

I propose to use SHGetFolderPath() with CSIDL_PROFILE argument to get the Windows user home directory.

ni4 commented 8 months ago

@antonsviridenko Thanks for the suggestion! You are welcome to make PR implementing this :)