import sublime
import sublime_plugin
import os
import subprocess
 
class run_visitor4(sublime_plugin.TextCommand):
	def run(self,file):
		file_to_open =self.view.file_name()
		tester = file_to_open[-4:]
		directory=sublime.packages_path()
		if (tester == '.pew' or tester == '.xyz' or tester == 'wrp'):
			file_final=str(' \"'+file_to_open+'\" ')
			cmd = "cd "+directory+" & cd Bin\visitor 4  & Start /I run "+file_final
			os.system(cmd)
		else:
			cmd = "cd "+directory+" & cd Bin\visitor 4  & Start /I run "
			os.system(cmd)