ó
W¼!_c           @   sñ   d  Z  d d l Z d d l Z e j j d ƒ Z e j j e ƒ d d l m	 Z	 d Z
 d Z e e j j d ƒ ƒ Z e	 e
 e ƒ Z d „  Z d	 „  Z d
 „  Z d „  Z d „  Z d „  Z e d k rí e j ƒ  sê d e j k rã qí e ƒ  n  d S(   s  
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: March 31 2020
@author: Dale Hamel, Brian Frisensky
@contact: brian.fristensky@umanitoba.ca

iÿÿÿÿNt   BIRCHLIB(   t   Birchmods   rmlauncher.py: s   
	USAGE: rmlauncher.pyt   BIRCH_PLATFORMc          C   s]   t  j j d ƒ }  t  j j |  ƒ rY |  d } t  j j | ƒ rP t d | GHqY d } n  | S(   sÀ   
        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
        t   HOMEs   /Desktops   Found desktop at: N(   t   ost   environt   gett   patht   existst   PROGRAMt   None(   t   home_dirt   desktop_dir(    (    s+   /home/psgendb/BIRCHDEV/script/rmlauncher.pyt   get_desktop"   s    
	c         C   s>   |  d } t  j j | ƒ r) t | ƒ n t d | d GHd  S(   Ns   /birch.desktops   Path :s    does not exist. Nothing to do.(   R   R   R   t   remove_launcherR	   (   R   t   launcher_path(    (    s+   /home/psgendb/BIRCHDEV/script/rmlauncher.pyt   rm_gnome_launcher6   s    
c         C   s`   xY d d g D]K } t  j j |  | ƒ } t  j j | ƒ rG t | ƒ q t d | d GHq Wd  S(   Ns	   birch.apps   biolegato.apps   Path :s    does not exist. Nothing to do.(   R   R   t   joinR   R   R	   (   R   t   launcherR   (    (    s+   /home/psgendb/BIRCHDEV/script/rmlauncher.pyt   rm_apple_launcher@   s
    c          C   sQ   t  j j d ƒ t  j j d ƒ }  t  j |  d ƒ t  j d ƒ t  j d ƒ d  S(   Nt	   HOMEDRIVEt   HOMEPATHs   /Desktops   rm bioLegato.lnks   rm birchTerm.lnk(   R   R   R   t   chdirt   system(   t	   home_path(    (    s+   /home/psgendb/BIRCHDEV/script/rmlauncher.pyt   rm_windows_launcherK   s    "c         C   s"   t  j d |  ƒ t d |  GHd  S(   Ns	   rm -r -f s   Removed launcher located at: (   R   R   R	   (   R   (    (    s+   /home/psgendb/BIRCHDEV/script/rmlauncher.pyR   S   s    c          C   sÌ   t  j j d ƒ }  t d k r{ t j d ƒ d k  r{ t  j j |  d ƒ } t | ƒ t  j j |  d d d ƒ } t | ƒ nD t d k r© t  j j |  d ƒ } t | ƒ n t d	 k r¿ t	 ƒ  n  t
 d
 GHd  S(   NR   s
   osx-x86_64t   wini    t   Desktops   .localt   sharet   applicationss   winxp-32s   Completed execution normally.(   R   R   R   t   PLATFORMt   findR   R   R   R   R   R	   (   R   R   (    (    s+   /home/psgendb/BIRCHDEV/script/rmlauncher.pyt
   rmlauncherW   s    "

t   __main__s   -test(   t   __doc__R   t   sysR   R   t   blibR   t   appendt   birchlibR   R	   t   USAGEt   strR   t   BMR   R   R   R   R   R    t   __name__t
   documentort   argv(    (    (    s+   /home/psgendb/BIRCHDEV/script/rmlauncher.pyt   <module>   s&   		
				