generalize into a func creating paths
This commit is contained in:
parent
051bff60c7
commit
036de12230
1 changed files with 9 additions and 10 deletions
|
@ -86,16 +86,14 @@ def check_and_possibly_create_paths():
|
||||||
os.chmod(dot_gajim, 0700) # rwx------
|
os.chmod(dot_gajim, 0700) # rwx------
|
||||||
|
|
||||||
if not os.path.exists(VCARDPATH):
|
if not os.path.exists(VCARDPATH):
|
||||||
print _('creating %s directory') % VCARDPATH
|
self.create_path(VCARDPATH)
|
||||||
os.mkdir(VCARDPATH, 0700)
|
|
||||||
elif os.path.isfile(VCARDPATH):
|
elif os.path.isfile(VCARDPATH):
|
||||||
print _('%s is file but it should be a directory') % VCARDPATH
|
print _('%s is file but it should be a directory') % VCARDPATH
|
||||||
print _('Gajim will now exit')
|
print _('Gajim will now exit')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
if not os.path.exists(AVATAR_PATH):
|
if not os.path.exists(AVATAR_PATH):
|
||||||
print _('creating %s directory') % AVATAR_PATH
|
self.create_path(AVATAR_PATH)
|
||||||
os.mkdir(AVATAR_PATH, 0700)
|
|
||||||
elif os.path.isfile(AVATAR_PATH):
|
elif os.path.isfile(AVATAR_PATH):
|
||||||
print _('%s is file but it should be a directory') % AVATAR_PATH
|
print _('%s is file but it should be a directory') % AVATAR_PATH
|
||||||
print _('Gajim will now exit')
|
print _('Gajim will now exit')
|
||||||
|
@ -110,14 +108,15 @@ def check_and_possibly_create_paths():
|
||||||
|
|
||||||
else: # dot_gajim doesn't exist
|
else: # dot_gajim doesn't exist
|
||||||
if dot_gajim: # is '' on win9x so avoid that
|
if dot_gajim: # is '' on win9x so avoid that
|
||||||
print _('creating %s directory') % dot_gajim
|
self.create_path(dot_gajim)
|
||||||
os.mkdir(dot_gajim, 0700)
|
|
||||||
if not os.path.isdir(VCARDPATH):
|
if not os.path.isdir(VCARDPATH):
|
||||||
print _('creating %s directory') % VCARDPATH
|
self.create_path(VCARDPATH)
|
||||||
os.mkdir(VCARDPATH, 0700)
|
|
||||||
if not os.path.exists(AVATAR_PATH):
|
if not os.path.exists(AVATAR_PATH):
|
||||||
print _('creating %s directory') % AVATAR_PATH
|
self.create_path(AVATAR_PATH)
|
||||||
os.mkdir(AVATAR_PATH, 0700)
|
|
||||||
if not os.path.isfile(LOG_DB_PATH):
|
if not os.path.isfile(LOG_DB_PATH):
|
||||||
create_log_db()
|
create_log_db()
|
||||||
gajim.logger.init_vars()
|
gajim.logger.init_vars()
|
||||||
|
|
||||||
|
def create_path(directory):
|
||||||
|
print _('creating %s directory') % directory
|
||||||
|
os.mkdir(dot_gajim, 0700)
|
||||||
|
|
Loading…
Add table
Reference in a new issue