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
 
113'>113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145