summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-03-12 18:13:32 +0100
committerhut <hut@lavabit.com>2010-03-12 18:13:32 +0100
commit766a5b6adb6fe568b2e2dbaa0b7c1bc94e535637 (patch)
tree356c4f6295058e71903840c6fda395e9ee5c61bc
parent69394f44516db77b126f997ca704bd77a3d76852 (diff)
downloadranger-766a5b6adb6fe568b2e2dbaa0b7c1bc94e535637.tar.gz
Renamed env.pwd to env.cwd ("Current Working Directory")
I initially used "pwd" since the command "pwd" prints the
current directory, but in this case, nothing is printed =P so
the "p" makes no sense.  "cwd" is a common abbreviation for
current working directory, so I chose that instead
-rw-r--r--ranger/__main__.py2
-rw-r--r--ranger/core/actions.py80
-rw-r--r--ranger/core/environment.py24
-rw-r--r--ranger/core/fm.py2
-rw-r--r--ranger/defaults/commands.py32
-rw-r--r--ranger/fsobject/directory.py2
-rw-r--r--ranger/gui/ui.py2
-rw-r--r--ranger/gui/widgets/console.py6
-rw-r--r--ranger/gui/widgets/statusbar.py4
9 files changed, 77 insertions, 77 deletions
diff --git a/ranger/__main__.py b/ranger/__main__.py
index f6da1910..aa0785e3 100644
--- a/ranger/__main__.py
+++ b/ranger/__main__.py
@@ -140,7 +140,7 @@ def main():
 		if 'my_ui' in vars():
 			my_ui.destroy()
 		if arg.cd_after_exit:
-			try: sys.__stderr__.write(my_fm.env.pwd.path)
+			try: sys.__stderr__.write(my_fm.env.cwd.path)
 			except: pass
 
 if __name__ == '__main__':
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index e281afc4..c4d82e58 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -51,12 +51,12 @@ class Actions(EnvironmentAware, SettingsAware):
 			elif order == 'tag':
 				fnc = lambda x: x.realpath in self.tags
 
-			return self.env.pwd.search_fnc(fnc=fnc, forward=forward)
+			return self.env.cwd.search_fnc(fnc=fnc, forward=forward)
 
 		elif order in ('size', 'mimetype', 'ctime'):
-			pwd = self.env.pwd
-			if original_order is not None or not pwd.cycle_list:
-				lst = list(pwd.files)
+			cwd = self.env.cwd
+			if original_order is not None or not cwd.cycle_list:
+				lst = list(cwd.files)
 				if order == 'size':
 					fnc = lambda item: -item.size
 				elif order == 'mimetype':
@@ -64,10 +64,10 @@ class Actions(EnvironmentAware, SettingsAware):
 				elif order == 'ctime':
 					fnc = lambda item: -int(item.stat and item.stat.st_ctime)
 				lst.sort(key=fnc)
-				pwd.set_cycle_list(lst)
-				return pwd.cycle(forward=None)
+				cwd.set_cycle_list(lst)
+				return cwd.cycle(forward=None)
 
-			return pwd.cycle(forward=forward)
+			return cwd.cycle(forward=forward)
 
 	def set_search_method(self, order, forward=True):
 		if order in ('search', 'tag', 'size', 'mimetype', 'ctime'):
@@ -85,9 +85,9 @@ class Actions(EnvironmentAware, SettingsAware):
 	def enter_dir(self, path, remember=False):
 		"""Enter the directory at the given path"""
 		if remember:
-			pwd = self.env.pwd
+			cwd = self.env.cwd
 			result = self.env.enter_dir(path)
-			self.bookmarks.remember(pwd)
+			self.bookmarks.remember(cwd)
 			return result
 		return self.env.enter_dir(path)
 
@@ -133,16 +133,16 @@ class Actions(EnvironmentAware, SettingsAware):
 		"""Enter the bookmark with the name <key>"""
 		try:
 			destination = self.bookmarks[key]
-			pwd = self.env.pwd
-			if destination.path != pwd.path:
+			cwd = self.env.cwd
+			if destination.path != cwd.path:
 				self.bookmarks.enter(key)
-				self.bookmarks.remember(pwd)
+				self.bookmarks.remember(cwd)
 		except KeyError:
 			pass
 
 	def set_bookmark(self, key):
 		"""Set the bookmark with the name <key> to the current directory"""
-		self.bookmarks[key] = self.env.pwd
+		self.bookmarks[key] = self.env.cwd
 
 	def unset_bookmark(self, key):
 		"""Delete the bookmark with the name <key>"""
@@ -271,24 +271,24 @@ class Actions(EnvironmentAware, SettingsAware):
 
 	def move_pointer(self, relative = 0, absolute = None, narg=None):
 		"""Move the pointer down by <relative> or to <absolute>"""
-		self.env.pwd.move(relative=relative,
+		self.env.cwd.move(relative=relative,
 				absolute=absolute, narg=narg)
 
 	def move_pointer_by_pages(self, relative):
 		"""Move the pointer down by <relative> pages"""
-		self.env.pwd.move(relative=int(relative * self.env.termsize[0]))
+		self.env.cwd.move(relative=int(relative * self.env.termsize[0]))
 
 	def move_pointer_by_percentage(self, relative=0, absolute=None, narg=None):
 		"""Move the pointer down by <relative>% or to <absolute>%"""
 		try:
-			factor = len(self.env.pwd) / 100.0
+			factor = len(self.env.cwd) / 100.0
 		except:
 			return
 
 		if narg is not None:
 			absolute = narg
 
-		self.env.pwd.move(
+		self.env.cwd.move(
 				relative=int(relative * factor),
 				absolute=int(absolute * factor))
 
@@ -296,7 +296,7 @@ class Actions(EnvironmentAware, SettingsAware):
 		"""Scroll down by <relative> lines"""
 		if hasattr(self.ui, 'scroll'):
 			self.ui.scroll(relative)
-			self.env.cf = self.env.pwd.pointed_obj
+			self.env.cf = self.env.cwd.pointed_obj
 
 	def redraw_window(self):
 		"""Redraw the window"""
@@ -304,7 +304,7 @@ class Actions(EnvironmentAware, SettingsAware):
 
 	def reset(self):
 		"""Reset the filemanager, clearing the directory buffer"""
-		old_path = self.env.pwd.path
+		old_path = self.env.cwd.path
 		self.env.directories = {}
 		self.enter_dir(old_path)
 
@@ -328,7 +328,7 @@ class Actions(EnvironmentAware, SettingsAware):
 
 	def reload_cwd(self):
 		try:
-			cwd = self.env.pwd
+			cwd = self.env.cwd
 		except:
 			pass
 		cwd.unload()
@@ -336,13 +336,13 @@ class Actions(EnvironmentAware, SettingsAware):
 
 	def traverse(self):
 		cf = self.env.cf
-		cwd = self.env.pwd
+		cwd = self.env.cwd
 		if cf is not None and cf.is_directory:
 			self.enter_dir(cf.path)
 		elif cwd.pointer >= len(cwd) - 1:
 			while True:
 				self.enter_dir('..')
-				cwd = self.env.pwd
+				cwd = self.env.cwd
 				if cwd.pointer < len(cwd) - 1:
 					break
 				if cwd.path == '/':
@@ -355,7 +355,7 @@ class Actions(EnvironmentAware, SettingsAware):
 
 	def set_filter(self, fltr):
 		try:
-			self.env.pwd.filter = fltr
+			self.env.cwd.filter = fltr
 		except:
 			pass
 
@@ -379,12 +379,12 @@ class Actions(EnvironmentAware, SettingsAware):
 		val - mark or unmark?
 		"""
 
-		if self.env.pwd is None:
+		if self.env.cwd is None:
 			return
 
-		pwd = self.env.pwd
+		cwd = self.env.cwd
 
-		if not pwd.accessible:
+		if not cwd.accessible:
 			return
 
 		if movedown is None:
@@ -395,17 +395,17 @@ class Actions(EnvironmentAware, SettingsAware):
 
 		if all:
 			if toggle:
-				pwd.toggle_all_marks()
+				cwd.toggle_all_marks()
 			else:
-				pwd.mark_all(val)
+				cwd.mark_all(val)
 		else:
-			for i in range(pwd.pointer, min(pwd.pointer + narg, len(pwd))):
-				item = pwd.files[i]
+			for i in range(cwd.pointer, min(cwd.pointer + narg, len(cwd))):
+				item = cwd.files[i]
 				if item is not None:
 					if toggle:
-						pwd.toggle_mark(item)
+						cwd.toggle_mark(item)
 					else:
-						pwd.mark_item(item, val)
+						cwd.mark_item(item, val)
 
 		if movedown:
 			self.move_pointer(relative=narg)
@@ -421,7 +421,7 @@ class Actions(EnvironmentAware, SettingsAware):
 		"""Copy the selected items"""
 
 		selected = self.env.get_selection()
-		self.env.copy = set(f for f in selected if f in self.env.pwd.files)
+		self.env.copy = set(f for f in selected if f in self.env.cwd.files)
 		self.env.cut = False
 
 	def cut(self):
@@ -453,7 +453,7 @@ class Actions(EnvironmentAware, SettingsAware):
 		if not copied_files:
 			return
 
-		original_path = self.env.pwd.path
+		original_path = self.env.cwd.path
 		try:
 			one_file = copied_files[0]
 		except:
@@ -472,8 +472,8 @@ class Actions(EnvironmentAware, SettingsAware):
 							dst=original_path,
 							overwrite=overwrite):
 						yield
-				pwd = self.env.get_directory(original_path)
-				pwd.load_content()
+				cwd = self.env.get_directory(original_path)
+				cwd.load_content()
 		else:
 			if len(copied_files) == 1:
 				descr = "copying: " + one_file.path
@@ -483,7 +483,7 @@ class Actions(EnvironmentAware, SettingsAware):
 				for f in self.env.copy:
 					if isdir(f.path):
 						for _ in shutil_g.copytree(src=f.path,
-								dst=join(self.env.pwd.path, f.basename),
+								dst=join(self.env.cwd.path, f.basename),
 								symlinks=True,
 								overwrite=overwrite):
 							yield
@@ -492,8 +492,8 @@ class Actions(EnvironmentAware, SettingsAware):
 								symlinks=True,
 								overwrite=overwrite):
 							yield
-				pwd = self.env.get_directory(original_path)
-				pwd.load_content()
+				cwd = self.env.get_directory(original_path)
+				cwd.load_content()
 
 		self.loader.add(LoadableObject(generate(), descr))
 
@@ -517,7 +517,7 @@ class Actions(EnvironmentAware, SettingsAware):
 
 	def mkdir(self, name):
 		try:
-			os.mkdir(os.path.join(self.env.pwd.path, name))
+			os.mkdir(os.path.join(self.env.cwd.path, name))
 		except OSError as err:
 			self.notify(err)
 
diff --git a/ranger/core/environment.py b/ranger/core/environment.py
index 347bd2b1..506e4230 100644
--- a/ranger/core/environment.py
+++ b/ranger/core/environment.py
@@ -25,7 +25,7 @@ class Environment(SettingsAware):
 	one class.
 	"""
 
-	pwd = None  # current directory
+	cwd = None  # current directory
 	cf = None  # current file
 	copy = None
 	cmd = None
@@ -90,8 +90,8 @@ class Environment(SettingsAware):
 					del self.directories[key]
 
 	def get_selection(self):
-		if self.pwd:
-			return self.pwd.get_selection()
+		if self.cwd:
+			return self.cwd.get_selection()
 		return set()
 
 	def get_directory(self, path):
@@ -121,8 +121,8 @@ class Environment(SettingsAware):
 			last_path = path
 
 	def ensure_correct_pointer(self):
-		if self.pwd:
-			self.pwd.correct_pointer()
+		if self.cwd:
+			self.cwd.correct_pointer()
 
 	def history_go(self, relative):
 		"""Move relative in history"""
@@ -141,15 +141,15 @@ class Environment(SettingsAware):
 			return
 
 		try:
-			new_pwd = self.get_directory(path)
+			new_cwd = self.get_directory(path)
 		except NoDirectoryGiven:
 			return False
 
 		self.path = path
-		self.pwd = new_pwd
+		self.cwd = new_cwd
 		os.chdir(path)
 
-		self.pwd.load_content_if_outdated()
+		self.cwd.load_content_if_outdated()
 
 		# build the pathway, a tuple of directory objects which lie
 		# on the path to the current directory.
@@ -166,11 +166,11 @@ class Environment(SettingsAware):
 		self.assign_cursor_positions_for_subdirs()
 
 		# set the current file.
-		self.pwd.directories_first = self.settings.directories_first
-		self.pwd.sort_if_outdated()
-		self.cf = self.pwd.pointed_obj
+		self.cwd.directories_first = self.settings.directories_first
+		self.cwd.sort_if_outdated()
+		self.cf = self.cwd.pointed_obj
 
 		if history:
-			self.history.add(new_pwd)
+			self.history.add(new_cwd)
 
 		return True
diff --git a/ranger/core/fm.py b/ranger/core/fm.py
index 3801dc9b..121d70b3 100644
--- a/ranger/core/fm.py
+++ b/ranger/core/fm.py
@@ -135,5 +135,5 @@ class FM(Actions):
 					self.env.garbage_collect()
 
 		finally:
-			self.bookmarks.remember(self.env.pwd)
+			self.bookmarks.remember(self.env.cwd)
 			self.bookmarks.save()
diff --git a/ranger/defaults/commands.py b/ranger/defaults/commands.py
index c9b3a878..dc7593a5 100644
--- a/ranger/defaults/commands.py
+++ b/ranger/defaults/commands.py
@@ -40,7 +40,7 @@ class Command(FileManagerAware):
 		from os.path import dirname, basename, expanduser, join, isdir
 
 		line = parse(self.line)
-		pwd = self.fm.env.pwd.path
+		cwd = self.fm.env.cwd.path
 
 		try:
 			rel_dest = line.rest(1)
@@ -52,7 +52,7 @@ class Command(FileManagerAware):
 			rel_dest = expanduser(rel_dest)
 
 		# define some shortcuts
-		abs_dest = join(pwd, rel_dest)
+		abs_dest = join(cwd, rel_dest)
 		abs_dirname = dirname(abs_dest)
 		rel_basename = basename(rel_dest)
 		rel_dirname = dirname(rel_dest)
@@ -89,7 +89,7 @@ class Command(FileManagerAware):
 		from os.path import dirname, basename, expanduser, join, isdir
 
 		line = parse(self.line)
-		pwd = self.fm.env.pwd.path
+		cwd = self.fm.env.cwd.path
 
 		try:
 			rel_dest = line.rest(1)
@@ -101,7 +101,7 @@ class Command(FileManagerAware):
 			rel_dest = expanduser(rel_dest)
 
 		# define some shortcuts
-		abs_dest = join(pwd, rel_dest)
+		abs_dest = join(cwd, rel_dest)
 		abs_dirname = dirname(abs_dest)
 		rel_basename = basename(rel_dest)
 		rel_dirname = dirname(rel_dest)
@@ -167,13 +167,13 @@ class cd(Command):
 	def quick_open(self):
 		from os.path import isdir, join, normpath
 		line = parse(self.line)
-		pwd = self.fm.env.pwd.path
+		cwd = self.fm.env.cwd.path
 
 		rel_dest = line.rest(1)
 		if not rel_dest:
 			return False
 
-		abs_dest = normpath(join(pwd, rel_dest))
+		abs_dest = normpath(join(cwd, rel_dest))
 		return rel_dest != '.' and isdir(abs_dest)
 
 
@@ -212,22 +212,22 @@ class find(Command):
 	def _search(self):
 		self.count = 0
 		line = parse(self.line)
-		pwd = self.fm.env.pwd
+		cwd = self.fm.env.cwd
 		try:
 			arg = line.rest(1)
 		except IndexError:
 			return False
 
-		deq = deque(pwd.files)
-		deq.rotate(-pwd.pointer)
+		deq = deque(cwd.files)
+		deq.rotate(-cwd.pointer)
 		i = 0
 		for fsobj in deq:
 			filename = fsobj.basename_lower
 			if arg in filename:
 				self.count += 1
 				if self.count == 1:
-					pwd.move(absolute=(pwd.pointer + i) % len(pwd.files))
-					self.fm.env.cf = pwd.pointed_obj
+					cwd.move(absolute=(cwd.pointer + i) % len(cwd.files))
+					self.fm.env.cf = cwd.pointed_obj
 			if self.count > 1:
 				return False
 			i += 1
@@ -277,7 +277,7 @@ class delete(Command):
 			# user did not confirm deletion
 			return
 
-		if self.fm.env.pwd.marked_items \
+		if self.fm.env.cwd.marked_items \
 		or (self.fm.env.cf.is_directory and not self.fm.env.cf.empty()):
 			# better ask for a confirmation, when attempting to
 			# delete multiple files or a non-empty directory.
@@ -298,7 +298,7 @@ class mkdir(Command):
 		from os import mkdir
 
 		line = parse(self.line)
-		dirname = join(self.fm.env.pwd.path, expanduser(line.rest(1)))
+		dirname = join(self.fm.env.cwd.path, expanduser(line.rest(1)))
 		if not lexists(dirname):
 			mkdir(dirname)
 		else:
@@ -317,7 +317,7 @@ class touch(Command):
 		from os import mkdir
 
 		line = parse(self.line)
-		fname = join(self.fm.env.pwd.path, expanduser(line.rest(1)))
+		fname = join(self.fm.env.cwd.path, expanduser(line.rest(1)))
 		if not lexists(fname):
 			open(fname, 'a')
 		else:
@@ -382,7 +382,7 @@ class rename(Command):
 		line = parse(self.line)
 		self.fm.rename(self.fm.env.cf, line.rest(1))
 		f = File(line.rest(1))
-		self.fm.env.pwd.pointed_obj = f
+		self.fm.env.cwd.pointed_obj = f
 		self.fm.env.cf = f
 
 	def tab(self):
@@ -423,7 +423,7 @@ class chmod(Command):
 		try:
 			# reloading directory.  maybe its better to reload the selected
 			# files only.
-			self.fm.env.pwd.load_content()
+			self.fm.env.cwd.load_content()
 		except:
 			pass
 
diff --git a/ranger/fsobject/directory.py b/ranger/fsobject/directory.py
index 5bbbe3e4..8bb8a78a 100644
--- a/ranger/fsobject/directory.py
+++ b/ranger/fsobject/directory.py
@@ -341,7 +341,7 @@ class Directory(FileSystemObject, Accumulator, SettingsAware):
 		Accumulator.correct_pointer(self)
 
 		try:
-			if self == self.fm.env.pwd:
+			if self == self.fm.env.cwd:
 				self.fm.env.cf = self.pointed_obj
 		except:
 			pass
diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py
index 69acda4b..77cde51d 100644
--- a/ranger/gui/ui.py
+++ b/ranger/gui/ui.py
@@ -197,7 +197,7 @@ class UI(DisplayableContainer):
 		if self.settings.update_title:
 			hostname = str(socket.gethostname())
 			try:
-				cwd = self.fm.env.pwd.path
+				cwd = self.fm.env.cwd.path
 			except:
 				cwd = ' - ranger'
 			sys.stdout.write("\033]2;" + hostname + cwd + "\007")
diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py
index 2ffd1a62..20753fbf 100644
--- a/ranger/gui/widgets/console.py
+++ b/ranger/gui/widgets/console.py
@@ -353,11 +353,11 @@ class SearchConsole(Console):
 
 	def execute(self):
 		import re
-		if self.fm.env.pwd:
+		if self.fm.env.cwd:
 			regexp = re.compile(self.line, re.L | re.U | re.I)
 			self.fm.env.last_search = regexp
 			if self.fm.search(order='search'):
-				self.fm.env.cf = self.fm.env.pwd.pointed_obj
+				self.fm.env.cf = self.fm.env.cwd.pointed_obj
 		self.close()
 
 
@@ -415,7 +415,7 @@ class OpenConsole(ConsoleWithTab):
 		else:
 			before_word, start_of_word = self.line.rsplit(' ', 1)
 			return (before_word + ' ' + file.shell_escaped_basename \
-					for file in self.fm.env.pwd.files \
+					for file in self.fm.env.cwd.files \
 					if file.shell_escaped_basename.startswith(start_of_word))
 
 	def _substitute_metachars(self, command):
diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py
index f15156df..26f5c7f4 100644
--- a/ranger/gui/widgets/statusbar.py
+++ b/ranger/gui/widgets/statusbar.py
@@ -81,8 +81,8 @@ class StatusBar(Widget):
 		if not self.result:
 			self.need_redraw = True
 
-		if self.old_du and not self.env.pwd.disk_usage:
-			self.old_du = self.env.pwd.disk_usage
+		if self.old_du and not self.env.cwd.disk_usage:
+			self.old_du = self.env.cwd.disk_usage
 			self.need_redraw = True
 
 		if self.old_cf != self.env.cf: