use realpath from argv[0] (otherwise symlinked default config locations = /usr/bin/local/config.json)

pull/9/head
l3uddz 7 years ago
parent 81cbae06e7
commit 8dce96842d

@ -1,5 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os.path import os.path
import sys
import time import time
import click import click
@ -22,7 +23,7 @@ notify = None
type=click.Path(file_okay=True, dir_okay=False), type=click.Path(file_okay=True, dir_okay=False),
help='Configuration file', help='Configuration file',
show_default=True, show_default=True,
default=os.path.join(os.path.dirname(os.path.abspath(__file__)), "config.json") default=os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), "config.json")
) )
@click.option( @click.option(
'--logfile', '--logfile',
@ -30,7 +31,7 @@ notify = None
type=click.Path(file_okay=True, dir_okay=False), type=click.Path(file_okay=True, dir_okay=False),
help='Log file', help='Log file',
show_default=True, show_default=True,
default=os.path.join(os.path.dirname(os.path.abspath(__file__)), "activity.log") default=os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), "activity.log")
) )
def app(config, logfile): def app(config, logfile):
# Setup global variables # Setup global variables

Loading…
Cancel
Save