File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,11 @@ def tell(self, id):
65
65
return [0 , file .tell ()]
66
66
except IOError , e :
67
67
return [e .errno , None ]
68
+
69
+ def isDir (self , filename ):
70
+ from os import path
71
+ return path .isdir (filename )
72
+
68
73
69
74
files = Files ()
70
75
@@ -124,12 +129,24 @@ def run(self, data):
124
129
res += chr ((pos >> 8 ) & 0xFF )
125
130
res += chr (pos & 0xFF )
126
131
return res
132
+
133
+
134
+ class ISDIRECTORY_Command :
135
+ def run (self , data ):
136
+ filename = data [0 :]
137
+ if files .isDir (filename ) is True :
138
+ return chr (1 )
139
+ else :
140
+ return chr (0 )
141
+
142
+
127
143
128
144
def init (command_processor ):
129
145
command_processor .register ('F' , OPEN_Command ())
130
146
command_processor .register ('f' , CLOSE_Command ())
131
147
command_processor .register ('G' , READ_Command ())
132
148
command_processor .register ('g' , WRITE_Command ())
149
+ command_processor .register ('i' , ISDIRECTORY_Command ())
133
150
command_processor .register ('s' , SEEK_Command ())
134
151
command_processor .register ('S' , TELL_Command ())
135
152
You can’t perform that action at this time.
0 commit comments