diff --git a/pyfpdb/Configuration.py b/pyfpdb/Configuration.py index ae578f57..d1f0efec 100755 --- a/pyfpdb/Configuration.py +++ b/pyfpdb/Configuration.py @@ -84,18 +84,26 @@ def get_config(file_name, fallback = True): # print "config path 2=", config_path if os.path.exists(config_path): 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 if not fallback: return (False,False) +# Example configuration for debian package + if os.name == 'posix': + # If we're on linux, try to copy example from the place + # debian package puts it; get_default_config_path() creates + # the config directory for us so there's no need to check it + # again + example_path = '/usr/share/python-fpdb/' + file_name + '.example' + try: + shutil.copyfile(example_path, config_path) + msg = 'Configuration file created: %s\n' % config_path + logging.info(msg) + return (config_path,False) + except IOError: + pass + # OK, fall back to the .example file, should be in the start dir if os.path.exists(file_name + ".example"): try: