Closed ginty closed 4 years ago
I'm all for dropping dependencies where possible. On windows the easiest way to get the current user is to read the environment variable "USERNAME".
Is there a command line I can run to have origen tell me what it thinks my user name is?
Hi @pderouen, no command way to view it right now, quickest way would probably be just to make a quick test to do it.
The code to invoke is origen::USER.id()
.
@pderouen, are you planning to push an update for the Windows path here, or will we just go ahead and merge this?
This branch works as is from Windows
When releasing an initial version of the proj command it failed miserably because the function to determine the user ID didn't work. It did work in a debug build, but not in a release build. The root cause is inside a whoami crate that I used and which seems to use some clib internally - i.e. not easy to debug and I would like to get rid of it.
This update transitions to a less magic approach of simply running 'whoami' and capturing the output, and it now works for the production release Linux build.
@pderouen, any chance you could look at the Windows branch of this? Is there a similar command we could run in Windows space?
Note that one thing I discovered here is that
if cfg!(linux)
does not work, it has to be eitherif cfg!(unix)
orif cfg!(target_os="linux")
.