oscalls.py 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import os
  2. import platform
  3. from subprocess import *
  4. ostype = platform.system()
  5. def Open(arg): # XDG-OPEN (start the file in a default software)
  6. ############################################################################
  7. # This function is requested by people. I can't actually test it properly
  8. # because I don't use proprietary software. And in my opinion this function
  9. # should not even exists here.
  10. # In a GNU/Linux system to open a file with a default program you use xdg-open
  11. # that does the job for you. When talking to people I figured out that similar
  12. # functions exist on different OS as well. But unfortunatly they are all
  13. # different. It's start in Windows and open in MacOS systems. Or so I
  14. # understand. I could be wrong.
  15. # I'm not going to make sure that all xdg-open calls are done using this
  16. # function. So if you trying to run VCStudio on non GNU/Linux system please
  17. # take it into concideration. You can search for xdg-open in all files. And
  18. # change those commands to oscall.Open() instead. ( Keep in mind it has to
  19. # be imported first )
  20. # I don't condone use of non-free software.
  21. ############################################################################
  22. # For The Best OS Ever
  23. if ostype == "Linux": ##### ## ## ## ##
  24. Popen(["xdg-open", arg]) ## ## #### ## ## ##
  25. # For Stinky. Like very, very Stinky ## ## ## ## ## ##
  26. elif ostype == "Windows": ## #### ## ## ## ## ##
  27. os.system("start "+arg) ## # ## ## ## ## ## ##
  28. # For Not that Stinky but it is Stinky ## ## ## #### ## ##
  29. elif ostype == "Darwin": ##### ## ## ####
  30. os.system("open "+arg)