summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--code/directory.rb66
1 files changed, 66 insertions, 0 deletions
diff --git a/code/directory.rb b/code/directory.rb
new file mode 100644
index 00000000..5c6e84c1
--- /dev/null
+++ b/code/directory.rb
@@ -0,0 +1,66 @@
+# A Class that contains data about directories
+class Directory
+	class LoadStatus
+		# @n contains a three bit number: x3x2x1
+		# x1:
+		# 0 = not scheduled
+		# 1 = scheduled
+		# x3x2:
+		# 00 = nothing loaded
+		# 01 = got the list of files
+		# 10 = <undefined>
+		# 11 = got the list of files and entry objects
+		def initialize(n = 0)
+			@n = 0
+		end
+
+		def got_files?
+			# is bit 2 nd 3 == 01
+			return n & 2 == 2
+		end
+
+		def scheduled?
+			# is the first bit 1?
+			return n & 1 == 1
+		end
+
+		def got_objects?
+			return n & 4 == 4
+		end
+		attr_accessor :n
+	end
+
+	def initialize(path)
+		@path = path
+		@status = LoadStatus.new(0)
+		@files = []
+		@sort_time = nil
+		@mtime = nil
+#		@width = 1000
+		@read = false
+		@free_space = nil
+		@empty = true
+		@scheduled = false
+	end
+
+	# {{{ Trivial
+	def inspect
+		return "<Directory: #{path}>"
+	end
+	alias to_s inspect
+
+	def size
+		return @files.size
+	end
+
+	def not_loaded?
+		return @level == 0
+	end
+	def file_list_loaded?
+		return @level >= 1
+	end
+	def ready?
+		return @level >= 2
+	end
+	# }}}
+end
ipe.go?h=0.2.0&id=f9f523ad59491eda08003ce2ccc6d57d7f19ea1e'>^
7ecc6f9 ^
363aab5 ^




7ecc6f9 ^

363aab5 ^




























7ecc6f9 ^










3f30c27 ^








7ecc6f9 ^



133085b ^



7ecc6f9 ^
133085b ^
6797f93 ^
133085b ^
7ecc6f9 ^


363aab5 ^

8bb115d ^


217e85a ^



363aab5 ^
7ecc6f9 ^




363aab5 ^
363aab5 ^










7ecc6f9 ^





363aab5 ^
363aab5 ^




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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151