import sublime, sublime_plugin, subprocess, os

class open_cmd(sublime_plugin.TextCommand):
	def run(self, edit):
		directory = os.path.dirname(self.view.file_name())
		print directory
		fullPath=os.path.splitdrive(directory)
		driveLetter=str(fullPath[0:1])
		driveLetter = driveLetter.replace("(u'", "")
		driveLetter = driveLetter.replace("',)", "")
		print driveLetter
		cmd=''.join([driveLetter, '& cd ', directory, ' & color 02 && title POSEIDON TOOLS CONSOLE & echo off & echo current directory: ', directory,' & echo this CMD is now active... Enter your command: & echo on'])
		retcode = subprocess.Popen(["cmd", "/K",  cmd])

	def is_enabled(self):
		return self.view.file_name() and len(self.view.file_name()) > 0