INNER CODE UNIT · Python

find_config_file

ImranR98/apps.obtainium.imranr.dev · scripts/generate_from_url.py:116

def find_config_file(name):
    """Locate a config file by file name or path relative to the apps folder."""
    candidate = os.path.abspath(os.path.join(APPS_PATH, name))
    if os.path.commonpath([APPS_PATH, candidate]) != APPS_PATH:
        print(Fore.RED + "The file name must stay inside public/data/apps.")
        return None
    if "/" in name or os.path.sep in name:
        return candidate if os.path.exists(candidate) else None
    for folder in ("complex", "simple"):
        candidate = os.path.join(APPS_PATH, folder, name)
        if os.path.exists(candidate):
            return candidate
    return None


def create_new_config():
    """Create a new app config file."""
    url_input = input("Input URL to extract JSON from: ")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…