summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-04-14 15:53:02 +0200
committerhut <hut@lavabit.com>2010-04-14 15:53:02 +0200
commit57435fbf56e83fe9b73d51771b853b34cd7f41db (patch)
treebe1751f53daead370723fa36f7350c54c3ca259e
parent2f109a60fb6a7978b8259408ce8477824e4471e9 (diff)
downloadranger-57435fbf56e83fe9b73d51771b853b34cd7f41db.tar.gz
fsobject.fsobject: display more information
added attributes is_socket and is_fifo
add special file info to infostring
-rw-r--r--ranger/fsobject/fsobject.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/ranger/fsobject/fsobject.py b/ranger/fsobject/fsobject.py
index ada00bb0..f2f440c1 100644
--- a/ranger/fsobject/fsobject.py
+++ b/ranger/fsobject/fsobject.py
@@ -47,6 +47,8 @@ class FileSystemObject(MimeTypeAware, FileManagerAware):
 	runnable = False
 	is_link = False
 	is_device = False
+	is_socket = False
+	is_fifo = False
 	readlink = None
 	stat = None
 	infostring = None
@@ -175,6 +177,8 @@ class FileSystemObject(MimeTypeAware, FileManagerAware):
 					pass
 			mode = self.stat.st_mode
 			self.is_device = bool(stat.S_ISCHR(mode) or stat.S_ISBLK(mode))
+			self.is_socket = bool(stat.S_ISSOCK(mode))
+			self.is_fifo = bool(stat.S_ISFIFO(mode))
 			self.accessible = True
 
 		if self.accessible and os.access(self.path, os.F_OK):
@@ -197,7 +201,14 @@ class FileSystemObject(MimeTypeAware, FileManagerAware):
 				self.infostring = ' ' + human_readable(self.stat.st_size)
 			else:
 				self.type = T_UNKNOWN
-				self.infostring = None
+				if self.is_device:
+					self.infostring = 'dev'
+				elif self.is_fifo:
+					self.infostring = 'fifo'
+				elif self.is_socket:
+					self.infostring = 'sock'
+				else:
+					self.infostring = None
 
 		else:
 			if self.is_link:
@@ -215,10 +226,10 @@ class FileSystemObject(MimeTypeAware, FileManagerAware):
 		if self.permissions is not None:
 			return self.permissions
 
-		if self.accessible is False:
-			return '----------'
-
-		mode = self.stat.st_mode
+		try:
+			mode = self.stat.st_mode
+		except:
+			return '----??----'
 
 		if stat.S_ISDIR(mode):
 			perms = ['d']
gt; 2018-07-23 08:39:44 -0700 4388' href='/akkartik/mu/commit/relayout?h=hlt&id=0864900cfd5201924f00b20c479a89f94d824d41'>0864900c ^
b1bbe92d ^





b1bbe92d ^
0864900c ^


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