o
    ;?id›  ã                   @   s¶   d Z ddlZddlZej d¡Zej e¡ ddlm	Z	 dZ
dZeej d¡ƒZe	e
eƒZdd	„ Zd
d„ Zdd„ Zdd„ Zdd„ Zdd„ ZedkrYe ¡ sRdejv rTdS eƒ  dS dS )aŽ  
June 6th 2010, Dale Hamel, University of Manitoba
 Description: Determines whether the system is OS X or linux, and REMOVES
 the appropriate launcher on the user's desktop.

 **This script is the cleanup script for makelauncher.py, should be called by nobirch
 
 Synopsis: python rmlauncher.py


@modified: May 20 2023
@author: Dale Hamel, Brian Frisensky
@contact: brian.fristensky@umanitoba.ca

é    NÚBIRCHLIB)ÚBirchmodzrmlauncher.py: z
	USAGE: rmlauncher.pyÚBIRCH_PLATFORMc                  C   sH   t j d¡} t j | ¡r"| d }t j |¡r ttd | ƒ |S d}|S )zÀ
        Returns the location of the current user's desktop directory
        by reading the environment variable "HOME", and assuming that there
        is a "HOME/Desktop" directory
        ÚHOMEú/DesktopzFound desktop at: N)ÚosÚenvironÚgetÚpathÚexistsÚprintÚPROGRAM©Úhome_dirÚdesktop_dir© r   ú&/home/birch/BIRCH/script/rmlauncher.pyÚget_desktop"   s   þr   c                 C   s8   | d }t j |¡rt|ƒ d S ttd | d ƒ d S )Nz/birch.desktopúPath :ú does not exist. Nothing to do.)r   r
   r   Úremove_launcherr   r   )r   Úlauncher_pathr   r   r   Úrm_gnome_launcher6   s   r   c                 C   sF   dD ]}t j | |¡}t j |¡rt|ƒ qttd | d ƒ qd S )N)z	birch.appzbiolegato.appr   r   )r   r
   Újoinr   r   r   r   )r   Úlauncherr   r   r   r   Úrm_apple_launcher@   s   
úr   c                  C   s>   t j d¡t j d¡ } t  | d ¡ t  d¡ t  d¡ d S )NÚ	HOMEDRIVEÚHOMEPATHr   zrm bioLegato.lnkzrm birchTerm.lnk)r   r   r	   ÚchdirÚsystem)Ú	home_pathr   r   r   Úrm_windows_launcherK   s   
r!   c                 C   s"   t  d|  ¡ ttd |  ƒ d S )Nz	rm -r -f zRemoved launcher located at: )r   r   r   r   )r   r   r   r   r   S   s   r   c                  C   s¶   t j d¡} tdks*t d¡dk r*t j | d¡}t|ƒ t j | ddd¡}t|ƒ n)tdkr:t j | d¡}t|ƒ ntd	krJt j | d¡}t|ƒ n	td
krRt	ƒ  n	 t
td ƒ d S )Nr   z
osx-x86_64Úwinr   ÚDesktopz.localÚshareÚapplicationszmacos-arm64zwinxp-32zCompleted execution normally.)r   r   r	   ÚPLATFORMÚfindr
   r   r   r   r!   r   r   r   r   r   r   Ú
rmlauncherW   s    


r(   Ú__main__z-test)Ú__doc__r   Úsysr   r	   Úblibr
   ÚappendÚbirchlibr   r   ÚUSAGEÚstrr&   ÚBMr   r   r   r!   r   r(   Ú__name__Ú
documentorÚargvr   r   r   r   Ú<module>   s*    


û