INNER CODE UNIT · Python

is_valid_path

ArcSurge/Termius-Pro-zh_CN · lang.py:267

def is_valid_path(path):
    """验证路径是否存在且为目录"""
    return path and os.path.isdir(path)


def check_asar_existence(path):
    """检查指定路径下是否存在 app.asar 文件"""
    return os.path.exists(os.path.join(path, "app.asar"))


def select_directory(title):
    """弹出文件夹选择对话框"""
    try:
        root = tk.Tk()
        root.withdraw()
        selected_path = filedialog.askdirectory(title=title)
        root.destroy()
        return selected_path if is_valid_path(selected_path) else None

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…