~xj9/bbnet

7173ae3a3687221947eca6497b4729bfbaef45e0 — xj9 13 days ago 2858598
av98 - add config_dir argument
1 files changed, 7 insertions(+), 6 deletions(-)

M av98.py
M av98.py => av98.py +7 -6
@@ 211,7 211,7 @@ def restricted(inner):

class GeminiClient(cmd.Cmd):

    def __init__(self, restricted=False):
    def __init__(self, restricted=False, config_path=None):
        cmd.Cmd.__init__(self)

        # Set umask so that nothing we create can be read by anybody else.


@@ 221,11 221,12 @@ class GeminiClient(cmd.Cmd):

        # Find config directory
        ## Look for something pre-existing
        for confdir in ("~/.av98/", "~/.config/av98/"):
            confdir = os.path.expanduser(confdir)
            if os.path.exists(confdir):
                self.config_dir = confdir
                break
        for confdir in (config_path, "~/.av98/", "~/.config/av98/"):
            if confdir is not None:
                confdir = os.path.expanduser(confdir)
                if os.path.exists(confdir):
                    self.config_dir = confdir
                    break
        ## Otherwise, make one in .config if it exists
        else:
            if os.path.exists(os.path.expanduser("~/.config/")):