Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing build failures #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,18 @@ def output(view,str):

class runOpaBuildCommand(sublime_plugin.TextCommand):
def run(self, view):
panel = self.view.window().get_output_panel("exec")
dirname = os.path.dirname(self.view.file_name())
wait = 5
exe = exe_name
dirname = getAppDir(self.view.file_name())
panel = self.view.window().get_output_panel("exec")
output(panel, "Will build & run "+exe)
output(panel,"\nCompiling ...")
tbuild0 = modtime(os.path.join(dirname,exe)) # because we have no error code, we have to check if a new exe has been generated
self.view.window().run_command('build')
time.sleep(0.8) # for some reason the modification time is modified latter
tbuild1 = modtime(os.path.join(dirname,exe))
while tbuild0 == modtime(os.path.join(dirname,exe)) and wait:
wait -=1
time.sleep(1) # for some reason the modification time is modified latter
tbuild1 = modtime(os.path.join(dirname,exe))
if tbuild0 < tbuild1:
output(panel,"done\n")
output(panel,"\nStoping previous launch ...")
Expand All @@ -122,6 +125,18 @@ def run(self, view):

class stopRunOpaBuildCommand(sublime_plugin.TextCommand):
def run(self, view):
dirname = os.path.dirname(self.view.file_name())
dirname = getAppDir(self.view.file_name())
print "Will kill", exe_name
kill(self,dirname,exe_name)

def getAppDir(filepath):
dirname = os.path.dirname(filepath)
dn2 = dirname
dn1 = ""
while dn1 != dn2:
dn1 = dn2
if os.path.exists(os.path.join(dn1, "opa.conf")):
dirname = dn1
break
dn2 = os.path.dirname(dn1)
return dirname
2 changes: 1 addition & 1 deletion stdlib.sublime-completions
Original file line number Diff line number Diff line change
Expand Up @@ -2328,5 +2328,5 @@
"EClickable.simple",
"EClickable",
"Multimap"
\t]
]
}