Skip to content

Commit 8c7fd9c

Browse files
committed
support init nw package metadata in all processes
1 parent e39c01e commit 8c7fd9c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/nw_base.cc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,16 @@ Package* package(const base::FilePath* path) {
2121
}
2222

2323
Package* InitNWPackage() {
24-
if (!g_package)
25-
g_package = new Package();
24+
if (!g_package) {
25+
const base::CommandLine& command_line =
26+
*base::CommandLine::ForCurrentProcess();
27+
std::string process_type = command_line.GetSwitchValueASCII("type");
28+
if (process_type == "renderer") {
29+
base::FilePath pkg_path = command_line.GetSwitchValuePath("nwapp-path");
30+
g_package = new Package(pkg_path);
31+
} else
32+
g_package = new Package();
33+
}
2634
exit_code = 0;
2735
return g_package;
2836
}

0 commit comments

Comments
 (0)