From ef3294a8c19e217f7f2622f34f13d344cf15f0cd Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Mon, 17 Jun 2019 11:47:38 -0300 Subject: [PATCH] Fix: AUR installation when '.local/share/applications' does not exist --- {arch => aur}/register_app.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) rename {arch => aur}/register_app.py (74%) diff --git a/arch/register_app.py b/aur/register_app.py similarity index 74% rename from arch/register_app.py rename to aur/register_app.py index d057c6ed..ee5a91bb 100644 --- a/arch/register_app.py +++ b/aur/register_app.py @@ -1,4 +1,5 @@ # used for AUR installation +import os import subprocess import sys from pathlib import Path @@ -12,7 +13,12 @@ Exec = /usr/bin/fpakman Icon = /usr/lib/python{version}/site-packages/fpakman/resources/img/flathub_45.svg """.format(version="{}.{}".format(sys.version_info.major, sys.version_info.minor)) -file_path = '{}/.local/share/applications/fpakman.desktop'.format(str(Path.home())) +apps_path = '{}/.local/share/applications'.format(str(Path.home())) + +if not os.path.exists(apps_path): + os.mkdir(apps_path) + +file_path = apps_path + '/fpakman.desktop' with open(file_path, 'w+') as f: f.write(desktop_file)