import os
import platform
from subprocess import *

ostype = platform.system()

def Open(arg):  # XDG-OPEN (start the file in a default software)
    
    ############################################################################
    
    # This function is requested by people. I can't actually test it properly
    # because I don't use proprietary software. And in my opinion this function
    # should not even exists here. 
    
    # In a GNU/Linux system to open a file with a default program you use xdg-open
    # that does the job for you. When talking to people I figured out that similar
    # functions exist on different OS as well. But unfortunatly they are all
    # different. It's start in Windows and open in MacOS systems. Or so I 
    # understand. I could be wrong. 
    
    # I'm not going to make sure that all xdg-open calls are done using this
    # function. So if you trying to run VCStudio on non GNU/Linux system please
    # take it into concideration. You can search for xdg-open in all files. And
    # change those commands to oscall.Open() instead. ( Keep in mind it has to
    # be imported first )
    
    # I don't condone use of non-free software.  
    
    ############################################################################
    
    # For The Best OS Ever
    if ostype == "Linux":                     #####       ##        ##    ##        ##
        Popen(["xdg-open", arg])            ##      ##    ####      ##    ##        ##
    # For Stinky. Like very, very Stinky   ##             ##  ##    ##    ##        ##
    elif ostype == "Windows":             ##    ####      ##    ##  ##    ##        ##
        os.system("start "+arg)            ##   #  ##     ##     ## ##     ##      ##
    # For Not that Stinky but it is Stinky  ##      ##    ##      ####      ##    ##
    elif ostype == "Darwin":                  #####       ##        ##        ####
        os.system("open "+arg)