parent
254b185385
commit
1cb547a8de
@ -79,10 +79,7 @@ def download_dir():
|
||||
else:
|
||||
ddir = directory
|
||||
|
||||
try:
|
||||
os.makedirs(ddir)
|
||||
except FileExistsError:
|
||||
pass
|
||||
os.makedirs(ddir, exist_ok=True)
|
||||
|
||||
return ddir
|
||||
|
||||
@ -692,9 +689,7 @@ class AbstractDownloadItem(QObject):
|
||||
global last_used_directory
|
||||
|
||||
try:
|
||||
os.makedirs(os.path.dirname(self._filename))
|
||||
except FileExistsError:
|
||||
pass
|
||||
os.makedirs(os.path.dirname(self._filename), exist_ok=True)
|
||||
except OSError as e:
|
||||
self._die(e.strerror)
|
||||
|
||||
|
@ -240,8 +240,7 @@ class BookmarkManager(UrlMarkManager):
|
||||
|
||||
def _init_lineparser(self):
|
||||
bookmarks_directory = os.path.join(standarddir.config(), 'bookmarks')
|
||||
if not os.path.isdir(bookmarks_directory):
|
||||
os.makedirs(bookmarks_directory)
|
||||
os.makedirs(bookmarks_directory, exist_ok=True)
|
||||
|
||||
bookmarks_subdir = os.path.join('bookmarks', 'urls')
|
||||
self._lineparser = lineparser.LineParser(
|
||||
|
@ -72,8 +72,7 @@ class BaseLineParser(QObject):
|
||||
Return:
|
||||
True if the file should be saved, False otherwise.
|
||||
"""
|
||||
if not os.path.exists(self._configdir):
|
||||
os.makedirs(self._configdir, 0o755)
|
||||
os.makedirs(self._configdir, 0o755, exist_ok=True)
|
||||
return True
|
||||
|
||||
def _after_save(self):
|
||||
|
@ -290,10 +290,7 @@ def _create(path):
|
||||
0700. If the destination directory exists already the permissions
|
||||
should not be changed.
|
||||
"""
|
||||
try:
|
||||
os.makedirs(path, 0o700)
|
||||
except FileExistsError:
|
||||
pass
|
||||
os.makedirs(path, 0o700, exist_ok=True)
|
||||
|
||||
|
||||
def _init_dirs(args=None):
|
||||
|
Loading…
Reference in New Issue
Block a user