helgewl

"Monodevelop.exe" wrapper by Cauê Waneck @ wineHQ AppDB

Mar 1st, 2014
724
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python
  2. #encoding: utf-8
  3.  
  4. import subprocess, os, sys
  5.  
  6. #Helper function
  7. def winepath(path):
  8.     return subprocess.check_output(['winepath', path])
  9.  
  10. if len(sys.argv) < 3:
  11.     exit(0)
  12.  
  13. #Get project file unix path
  14. projectFilePath = winepath(sys.argv[2])
  15.  
  16. #Get project directory
  17. projectDir = os.path.dirname(projectFilePath)
  18.  
  19. #Get project file name without directory
  20. projectName = os.path.basename(projectFilePath)
  21.  
  22. #Get script file name
  23. fileName = winepath(sys.argv[3])[len(projectDir) + 1:]
  24.  
  25. #Change directory
  26. os.chdir(projectDir)
  27.  
  28. #Open monodevelop in current directory
  29. subprocess.call(['monodevelop', projectName, fileName])
RAW Paste Data