Expand ~ to home dir when using --with-library for calibre

This commit is contained in:
Kovid Goyal 2013-03-17 15:43:06 +05:30
parent e7767938da
commit 3db99c4dca

View File

@ -87,10 +87,11 @@ def init_qt(args):
opts, args = parser.parse_args(args) opts, args = parser.parse_args(args)
find_portable_library() find_portable_library()
if opts.with_library is not None: if opts.with_library is not None:
if not os.path.exists(opts.with_library): libpath = os.path.expanduser(opts.with_library)
os.makedirs(opts.with_library) if not os.path.exists(libpath):
if os.path.isdir(opts.with_library): os.makedirs(libpath)
prefs.set('library_path', os.path.abspath(opts.with_library)) if os.path.isdir(libpath):
prefs.set('library_path', os.path.abspath(libpath))
prints('Using library at', prefs['library_path']) prints('Using library at', prefs['library_path'])
QCoreApplication.setOrganizationName(ORG_NAME) QCoreApplication.setOrganizationName(ORG_NAME)
QCoreApplication.setApplicationName(APP_UID) QCoreApplication.setApplicationName(APP_UID)