Skip to content

Commit

Permalink
fixed compilation before tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ostinelli committed Apr 20, 2012
1 parent c17d460 commit bf8df72
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions sublimerl.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def get_erlang_module_name(self):

def set_cwd_to_otp_project_root(self):
global SUBLIMERL_LAST_ROOT
if self.new == True:
if self.new == True or SUBLIMERL_LAST_ROOT == None:
# get otp directory
current_file_path = os.path.dirname(self.view.file_name())
otp_project_root = self.get_otp_project_root(current_file_path)
Expand All @@ -190,7 +190,7 @@ def set_cwd_to_otp_project_root(self):
SUBLIMERL_LAST_ROOT = os.path.abspath(otp_project_root)

# set current directory to root - needed by rebar
if SUBLIMERL_LAST_ROOT: os.chdir(SUBLIMERL_LAST_ROOT)
os.chdir(SUBLIMERL_LAST_ROOT)

def get_otp_project_root(self, current_dir):
# if compliant, return
Expand Down Expand Up @@ -239,7 +239,6 @@ def compile_source(self):
# compile to ebin
retcode, data = self.execute_os_command('%s compile' % self.rebar_path, True)


# test runner
class SublimErlTestRunner(SublimErlLauncher):

Expand Down Expand Up @@ -531,7 +530,7 @@ class SublimErlListener(sublime_plugin.EventListener):
def on_post_save(self, view):
# ensure context matches
caret = view.sel()[0].a
if not 'source.erlang' in view.scope_name(caret): return
if not ('source.erlang' in view.scope_name(caret) and sublime.platform() != 'windows'): return
# init
launcher = SublimErlLauncher(view, show_log=False, new=False)
if launcher.available == False: return
Expand Down

0 comments on commit bf8df72

Please sign in to comment.