Accessing home directory with home interface

I still face this issue now. I am not sure is there any recommended to solve this?

I am using Rust’s dirs::home_dir() function and it returns /home/<user>/snap/<package> path instead of /home/<user>. This is happening only when I install install via snap.

I did some digging and seems like dirs::home_dir() function depends on $HOME.

As @Lin-Buo-Ren mentioned, snapcraft-dektop-helpers handles the Documents, Videos, etc directories.
but not HOME directory.

What’s the recommended way do solve this issue?
Should I add additional conditions or use this method?

SNAP VERSION
snap 2.39.3
snapd 2.39.3
series 16
ubuntu 18.04
kernel 4.15.0-55-generic