Fetch Home Directory

Hey folks,

Is there a way to fetch the home directory from the front-end browser? Also, is there a way to check whether the current URI path is in the home directory?

The reason I want the above info is because, I want to restrict some functionalities if the user’s current URI path is outside of the home directory and we know that, Theia access the entire underlying OS workspace including directories like /etc

Any help here would be highly appreciated!! Thanks in advance!!

Regards,
Chid

@chid.crushev thank you for the discussion.

Is there a way to fetch the home directory from the front-end browser?

You can use EnvVariablesServer to retrieve the home directory URI using getHomeDirUri.
Here’s an example:

Also, is there a way to check whether the current URI path is in the home directory?

You can simply process this information yourself using URI methods given you know the user’s home.

Thanks a lot. It worked