Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(628)

Unified Diff: sky/tools/skydb

Issue 654543004: Teach tools/skydb how to handle paths (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/tools/skydb
diff --git a/sky/tools/skydb b/sky/tools/skydb
index caa8f8093fa5af948c1fa9ef53a2a8ee5b0a4107..5b3732fb20d86e8f089b534d5837133c86149f43 100755
--- a/sky/tools/skydb
+++ b/sky/tools/skydb
@@ -6,6 +6,7 @@
import os
import subprocess
import sys
+import urlparse
BUILD_DIRECTORY = 'out'
@@ -18,6 +19,19 @@ SUPPORTED_MIME_TYPES = [
'text/plain',
]
+def start_http_server_for_file(path):
+ HTTP_PORT = 9999
+ directory = os.path.dirname(os.path.abspath(path))
+ server_command = [
+ 'python',
+ '-m',
+ 'SimpleHTTPServer',
+ str(HTTP_PORT)
+ ]
+ subprocess.Popen(server_command, cwd=directory)
+ return 'http://localhost:%s/%s' % (HTTP_PORT, os.path.basename(path))
+
+
def main(args):
content_handlers = ['%s,%s' % (mime_type, 'mojo://sky_viewer/')
for mime_type in SUPPORTED_MIME_TYPES]
@@ -29,7 +43,12 @@ def main(args):
'mojo:window_manager',
]
if args:
- prompt_args = '--args-for=mojo://sky_debugger_prompt/ %s' % args[0]
+ url = args[0]
+ parse_result = urlparse.urlparse(url)
+ if not parse_result.scheme:
+ url = start_http_server_for_file(url)
+
+ prompt_args = '--args-for=mojo://sky_debugger_prompt/ %s' % url
shell_command.append(prompt_args)
subprocess.check_call(shell_command)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698