📝 Created first functions
Created main.py Defined apps directory using pathlib Created ensure_apps_dir function for checking apps directory Crated list_appimage_files function for listing all AppImage files in the apps directory
This commit is contained in:
parent
454565c8e6
commit
a53b04de8c
28
main.py
Normal file
28
main.py
Normal file
@ -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()
|
Loading…
x
Reference in New Issue
Block a user