diff --git a/downloadmanager.py b/downloadmanager.py
index e41d06f..c793e5c 100644
a
|
b
|
|
14 | 14 | # along with this program; if not, write to the Free Software |
15 | 15 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
16 | 16 | |
17 | | import os |
| 17 | import os, os.path |
| 18 | import shutil |
18 | 19 | import logging |
19 | 20 | from gettext import gettext as _ |
20 | 21 | import time |
… |
… |
class Download: |
161 | 162 | if NS_FAILED(status): # download cancelled |
162 | 163 | return |
163 | 164 | |
| 165 | basedir = os.path.dirname(self._target_file.path) |
| 166 | final_target = os.path.join(basedir, self._get_file_name()) |
| 167 | |
| 168 | #TODO: Handle multiple filenames |
| 169 | shutil.move(self._target_file.path, final_target) |
| 170 | |
164 | 171 | self._stop_alert = Alert() |
165 | 172 | self._stop_alert.props.title = _('Download completed') |
166 | 173 | self._stop_alert.props.msg = _('%s' % self._get_file_name()) |
… |
… |
class Download: |
178 | 185 | self.dl_jobject.metadata['title'] = _('File %s from %s.') % \ |
179 | 186 | (self._get_file_name(), self._source.spec) |
180 | 187 | self.dl_jobject.metadata['progress'] = '100' |
181 | | self.dl_jobject.file_path = self._target_file.path |
| 188 | self.dl_jobject.file_path = final_target |
182 | 189 | |
183 | | if self._mime_type == 'application/octet-stream': |
184 | | sniffed_mime_type = mime.get_for_file(self._target_file.path) |
| 190 | if self._mime_type == 'application/octet-stream' or \ |
| 191 | self._mime_type == 'application/x-zip': |
| 192 | sniffed_mime_type = mime.get_for_file(final_target) |
185 | 193 | self.dl_jobject.metadata['mime_type'] = sniffed_mime_type |
186 | 194 | |
187 | 195 | datastore.write(self.dl_jobject, |