code: def path():
          
          # Detect config directory
          try:
              directory = os.environ["DID_DIR"]
          except KeyError:
              directory = CONFIG
          # Detect config file (even before options are parsed)
          filename = "config"
          matched = re.search("--confi?g?[ =](\S+)", " ".join(sys.argv))
          if matched:
              filename = matched.groups()[0]
          return directory.rstrip("/") + "/" + filename
docs: Detect config file path