Fix config file copying for debian package

If there is no config file in ~/.fpdb/ copy it from the package's
/usr/share path
This commit is contained in:
Mika Bostrom 2010-08-17 07:56:00 +03:00
parent 62ddab3232
commit c49565fcb1

View File

@ -84,6 +84,13 @@ def get_config(file_name, fallback = True):
# print "config path 2=", config_path # print "config path 2=", config_path
if os.path.exists(config_path): if os.path.exists(config_path):
return (config_path,False) return (config_path,False)
# Copy from example (debian package)
try:
example_path = '/usr/share/python-fpdb/' + file_name + '.example'
shutil.copyfile(example_path, config_path)
return (config_path,False)
except IOError:
pass
# No file found # No file found
if not fallback: if not fallback: