IGN:Better error handling when library is on a removable device that no longer exists

This commit is contained in:
Kovid Goyal 2009-03-10 13:01:18 -07:00
parent 72581c6e32
commit 06e5659d79

View File

@ -1406,6 +1406,14 @@ class Main(MainWindow, Ui_MainWindow):
dir = os.path.expanduser('~/Library')
self.library_path = os.path.abspath(dir)
if not os.path.exists(self.library_path):
try:
os.makedirs(self.library_path)
except:
self.library_path = os.path.expanduser('~/Library')
error_dialog(self, _('Invalid library location'),
_('Could not access %s. Using %s as the library.')%
(repr(self.library_path), repr(self.library_path))
).exec_()
os.makedirs(self.library_path)