116 @type str (optional) |
116 @type str (optional) |
117 @return tuple containing the listed directory, the path separartor and the |
117 @return tuple containing the listed directory, the path separartor and the |
118 directory listing. Each directory listing entry contains a dictionary |
118 directory listing. Each directory listing entry contains a dictionary |
119 with the relevant data. |
119 with the relevant data. |
120 @rtype tuple of (str, str, dict) |
120 @rtype tuple of (str, str, dict) |
|
121 @exception OSError raised in case the server reported an issue |
121 """ |
122 """ |
122 if directory is None: |
123 if directory is None: |
123 # sanitize the directory in case it is None |
124 # sanitize the directory in case it is None |
124 directory = "" |
125 directory = "" |
125 |
126 |
126 loop = QEventLoop() |
127 loop = QEventLoop() |
|
128 ok = False |
|
129 error = "" |
127 listedDirectory = "" |
130 listedDirectory = "" |
128 separator = "" |
131 separator = "" |
129 listing = [] |
132 listing = [] |
130 |
133 |
131 def callback(reply, params): |
134 def callback(reply, params): |
135 @param reply name of the server reply |
138 @param reply name of the server reply |
136 @type str |
139 @type str |
137 @param params dictionary containing the reply data |
140 @param params dictionary containing the reply data |
138 @type dict |
141 @type dict |
139 """ |
142 """ |
140 nonlocal listedDirectory, listing, separator |
143 nonlocal listedDirectory, listing, separator, ok, error |
141 |
144 |
142 if reply == "Listdir": |
145 if reply == "Listdir": |
143 listedDirectory = params["directory"] |
146 ok = params["ok"] |
144 listing = params["listing"] |
147 if ok: |
145 separator = params["separator"] |
148 listedDirectory = params["directory"] |
|
149 listing = params["listing"] |
|
150 separator = params["separator"] |
|
151 else: |
|
152 error = params["error"] |
146 loop.quit() |
153 loop.quit() |
147 |
154 |
148 self.__serverInterface.sendJson( |
155 self.__serverInterface.sendJson( |
149 category=EricRequestCategory.FileSystem, |
156 category=EricRequestCategory.FileSystem, |
150 request="Listdir", |
157 request="Listdir", |
151 params={"directory": directory}, |
158 params={"directory": directory}, |
152 callback=callback, |
159 callback=callback, |
153 ) |
160 ) |
154 |
161 |
155 loop.exec() |
162 loop.exec() |
|
163 if not ok: |
|
164 raise OSError(error) |
|
165 |
156 return listedDirectory, separator, listing |
166 return listedDirectory, separator, listing |
157 |
167 |
158 def stat(self, filename, stNames): |
168 def stat(self, filename, stNames): |
159 """ |
169 """ |
160 Public method to get the status of a file. |
170 Public method to get the status of a file. |