Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SublimeHaskellRun(SublimeHaskellBaseCommand):
- def run(self):
- """Run general build commands"""
- window, view, file_shown_in_view = get_haskell_command_window_view_file_project()
- if not file_shown_in_view:
- return
- syntax_file_for_view = view.settings().get('syntax').lower()
- if 'haskell' not in syntax_file_for_view:
- return
- cabal_project_dir, cabal_project_name = get_cabal_project_dir_and_name_of_view(view)
- if not cabal_project_dir:
- return
- if view.is_dirty():
- view.run_command("save")
- run_build('configure')
- run_build('build')
- with open(os.path.join(cabal_project_dir, cabal_project_name + '.cabal'), 'r') as f:
- cabal_file = f.read()
- executables = re.compile("Executable\s+(\S+)").findall(cabal_file)
- if len(executables) == 0:
- return
- executable = executables[0]
- os.chdir(cabal_project_dir)
- cmd = os.path.join("dist", "build", cabal_project_name, cabal_project_name + ".exe")
- os.system(cmd)
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement