summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/fsobject/directory.py27
1 files changed, 12 insertions, 15 deletions
diff --git a/ranger/fsobject/directory.py b/ranger/fsobject/directory.py
index fd4679ce..e307e20a 100644
--- a/ranger/fsobject/directory.py
+++ b/ranger/fsobject/directory.py
@@ -81,7 +81,6 @@ class Directory(FileSystemObject, Accumulator, Loadable, SettingsAware):
 	content_loaded = False
 
 	_cumulative_size_calculated = False
-	_cumulative_size_needs_update = False
 
 	sort_dict = {
 		'basename': sort_by_basename,
@@ -191,11 +190,11 @@ class Directory(FileSystemObject, Accumulator, Loadable, SettingsAware):
 				filelist = os.listdir(mypath)
 
 				if self._cumulative_size_calculated:
-					if self.content_loaded:
-						self._cumulative_size_needs_update = True
-					self.infostring = '%s' % (human_readable(
-						self.size, seperator=\
-						('? ' if self._cumulative_size_needs_update else ' ')))
+					# If self.content_loaded is true, this is not the first
+					# time loading.  So I can't really be sure if the
+					# size has changed and I'll add a "?".
+					self.infostring = ' %s' % (human_readable(self.size,
+						seperator=('? ' if self.content_loaded else ' ')))
 				else:
 					self.size = len(filelist)
 					self.infostring = ' %d' % self.size
@@ -346,27 +345,25 @@ class Directory(FileSystemObject, Accumulator, Loadable, SettingsAware):
 		if self.size == 0:
 			return 0
 		cum = 0
+		realpath = os.path.realpath
 		for dirpath, dirnames, filenames in os.walk(self.path,
 				onerror=lambda _: None):
 			for file in filenames:
 				try:
 					if dirpath == self.path:
-						stat = os.stat(os.path.realpath(dirpath + "/" + file))
+						stat = os_stat(realpath(dirpath + "/" + file))
 					else:
-						stat = os.stat(dirpath + "/" + file)
+						stat = os_stat(dirpath + "/" + file)
 					cum += stat.st_size
 				except:
 					pass
 		return cum
 
 	def look_up_cumulative_size(self):
-		if self._cumulative_size_needs_update or \
-				not self._cumulative_size_calculated:
-			self._cumulative_size_calculated = True
-			self._cumulative_size_needs_update = False
-			self.size = self._get_cumulative_size()
-			self.infostring = ('-> ' if self.is_link else ' ') + \
-					human_readable(self.size)
+		self._cumulative_size_calculated = True
+		self.size = self._get_cumulative_size()
+		self.infostring = ('-> ' if self.is_link else ' ') + \
+				human_readable(self.size)
 
 	@lazy_property
 	def size(self):
title='author James Booth <boothj5@gmail.com> 2016-02-01 01:42:09 +0000 committer James Booth <boothj5@gmail.com> 2016-02-01 01:42:09 +0000 Updated themes' href='/danisanti/profani-tty/commit/themes/boothj5_slack?id=f0837abf0a56a2f77a79c7e4fe6f25de33bb012f'>f0837abf ^
3666eb4f ^
















f0837abf ^
3666eb4f ^
f0837abf ^
3666eb4f ^


f0837abf ^
3666eb4f ^



f0837abf ^
3666eb4f ^
f0837abf ^
3666eb4f ^
f0837abf ^
3666eb4f ^



f0837abf ^
3666eb4f ^

abc2f0de ^
3666eb4f ^

f0837abf ^
3666eb4f ^
f0837abf ^




3666eb4f ^






f0837abf ^
72c1c496 ^
bab75cae ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135