提交 6b6f81e3 编写于 作者: A Adam Barth

Teach SkyShell.app to run local files

Previously we defaulted to loading from URLs, but its
more common to want to load files off the local machine
on the command line.
上级 7e9abfa2
......@@ -85,12 +85,6 @@ static inline sky::EventType EventTypeFromNSEventPhase(NSEventPhase phase) {
self.platformView->ConnectToEngine(interface_request.Pass());
base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess();
base::CommandLine::StringVector args = command_line.GetArgs();
if (args.size() > 0) {
mojo::String string(args[0]);
_sky_engine->RunFromNetwork(string);
return;
}
if (command_line.HasSwitch(sky::shell::switches::kSnapshot)) {
auto snapshot = command_line.GetSwitchValueASCII(sky::shell::switches::kSnapshot);
......@@ -98,9 +92,15 @@ static inline sky::EventType EventTypeFromNSEventPhase(NSEventPhase phase) {
return;
}
auto args = command_line.GetArgs();
if (args.size() > 0) {
_sky_engine->RunFromFile(args[0],
command_line.GetSwitchValueASCII(sky::shell::switches::kPackageRoot));
return;
}
NSString *endpoint = self.skyInitialBundleURL;
if (endpoint.length > 0) {
// Load from bundle
mojo::String string(endpoint.UTF8String);
_sky_engine->RunFromBundle(string);
return;
......@@ -108,7 +108,6 @@ static inline sky::EventType EventTypeFromNSEventPhase(NSEventPhase phase) {
endpoint = self.skyInitialLoadURL;
if (endpoint.length > 0) {
// Load from URL
mojo::String string(endpoint.UTF8String);
_sky_engine->RunFromNetwork(string);
return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册