From a53b04de8c82f46fb7aa73d1886a4ab0c62db609 Mon Sep 17 00:00:00 2001 From: muwat Date: Wed, 4 Dec 2024 16:05:04 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Created=20first=20functions=20Cr?= =?UTF-8?q?eated=20main.py=20Defined=20apps=20directory=20using=20pathlib?= =?UTF-8?q?=20Created=20ensure=5Fapps=5Fdir=20function=20for=20checking=20?= =?UTF-8?q?apps=20directory=20Crated=20list=5Fappimage=5Ffiles=20function?= =?UTF-8?q?=20for=20listing=20all=20AppImage=20files=20in=20the=20apps=20d?= =?UTF-8?q?irectory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 main.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..1d4cba3 --- /dev/null +++ b/main.py @@ -0,0 +1,28 @@ +from pathlib import Path + +# Apps directory +apps_dir = Path.home() / "Apps" + +# Create the Apps directory if doesn't exists +def ensure_apps_dir(): + if not apps_dir.exists(): + apps_dir.mkdir(parents=True) + print(f"Created {apps_dir} directory.") + else: + print(f"{apps_dir} directory exists.") + +# List AppImage files in the directory +def list_appimage_files(): + appimage_files = [file.name for file in apps_dir.iterdir() if file.is_file() and file.suffix == ".AppImage"] + if appimage_files: + print("AppImage files found:") + for app in appimage_files: + print(f" - {app}") + else: + print("No AppImage files found in ~/Apps directory.") + +# Ensure the Apps directory exists +ensure_apps_dir() + +# List AppImage files +list_appimage_files() \ No newline at end of file