only change storage dir location if move is successful

This commit is contained in:
Marcos Pinto 2007-07-11 20:59:33 +00:00
commit 7938cb7fba
2 changed files with 8 additions and 7 deletions

View file

@ -528,8 +528,12 @@ class Manager:
if event['event_type'] is self.constants['EVENT_FINISHED']: if event['event_type'] is self.constants['EVENT_FINISHED']:
# Queue seeding torrent to bottom if needed # Queue seeding torrent to bottom if needed
if(self.get_pref('enable_move_completed')): if(self.get_pref('enable_move_completed')):
deluge_core.move_storage(event['unique_ID'], self.get_pref('default_finished_path')) try:
self.unique_IDs[event['unique_ID']].save_dir = self.get_pref('default_finished_path') deluge_core.move_storage(event['unique_ID'], self.get_pref('default_finished_path'))
except SystemError:
print "You cannot move downloaded file/folder to a different partition"
else:
self.unique_IDs[event['unique_ID']].save_dir = self.get_pref('default_finished_path')
if self.get_pref('queue_seeds_to_bottom'): if self.get_pref('queue_seeds_to_bottom'):
self.queue_bottom(event['unique_ID']) self.queue_bottom(event['unique_ID'])
# If we are autoseeding, then we need to apply the queue # If we are autoseeding, then we need to apply the queue

View file

@ -548,12 +548,9 @@ static PyObject *torrent_move_storage(PyObject *self, PyObject *args)
boost::filesystem::path move_dir_2 (move_dir, empty_name_check); boost::filesystem::path move_dir_2 (move_dir, empty_name_check);
try try
{ {
/*libtorrent's move_storage only works within same partition
move_storage returns afterwards save_path should equal move_dir_2*/
M_torrents->at(index).handle.move_storage(move_dir_2); M_torrents->at(index).handle.move_storage(move_dir_2);
//if(M_torrents->at(index).handle.save_path()!=move_dir_2) if(M_torrents->at(index).handle.save_path()!=move_dir_2)
//return NULL; return NULL;
//throw error here to let user know
} }
catch (boost::filesystem::filesystem_error&) catch (boost::filesystem::filesystem_error&)
{ RAISE_PTR(FilesystemError, ""); } { RAISE_PTR(FilesystemError, ""); }