summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/core/environment.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/ranger/core/environment.py b/ranger/core/environment.py
index 984db57c..a30b8dcd 100644
--- a/ranger/core/environment.py
+++ b/ranger/core/environment.py
@@ -13,12 +13,15 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-from os.path import abspath, normpath, join, expanduser, isdir
+import curses
 import os
+import pwd
+import socket
+from os.path import abspath, normpath, join, expanduser, isdir
+
 from ranger.fsobject.directory import Directory, NoDirectoryGiven
 from ranger.container import KeyBuffer, History
 from ranger.shared import SettingsAware
-import curses
 
 class Environment(SettingsAware):
 	"""A collection of data which is relevant for more than
@@ -46,6 +49,13 @@ class Environment(SettingsAware):
 		self.copy = set()
 		self.history = History(self.settings.max_history_size)
 
+		try:
+			self.username = pwd.getpwuid(os.geteuid()).pw_name
+		except:
+			self.username = 'uid:' + str(os.geteuid())
+		self.hostname = socket.gethostname()
+		self.home_path = os.path.expanduser('~')
+
 		from ranger.shared import EnvironmentAware
 		EnvironmentAware.env = self