Skip to content
Snippets Groups Projects
Commit 4c0f8501 authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

first draft getting the "open" event to work under Windows

parent d5c58a3a
No related branches found
No related tags found
No related merge requests found
...@@ -262,6 +262,7 @@ function add_events() { ...@@ -262,6 +262,7 @@ function add_events() {
// Opening another file // Opening another file
nw.App.on("open", function(argv_string) { nw.App.on("open", function(argv_string) {
var port, var port,
host,
pd_engine_id, pd_engine_id,
argv; argv;
if (argv_string.slice(0, 7) === "file://") { if (argv_string.slice(0, 7) === "file://") {
...@@ -279,10 +280,24 @@ function add_events() { ...@@ -279,10 +280,24 @@ function add_events() {
// open the GUI, supplying us with a port number and // open the GUI, supplying us with a port number and
// an instance id. In this case, we need to create a // an instance id. In this case, we need to create a
// socket connection and fetch the file-list... // socket connection and fetch the file-list...
argv = argv_string.split(" "); pd_engine_id = argv_string.split(" ").slice(-1).join();
port = +argv.slice(-5, -4); argv_string = argv_string.slice(0, -pd_engine_id.length).trim();
pd_engine_id = argv.slice(-1); // strip off the gui dir
pdgui.connect_as_client_to_secondary_instance("localhost", port, argv_string = argv_string.slice(0,
-nw.App.argv[3].length).trim();
if (process.platform === "win32") {
// windows quotes this string, so let's remove the two
// quotation marks
argv_string = argv_string.slice(0, -2).trim();
}
// now strip off the k12 string, which is guaranteed not
// to have any spaces in it
argv_string = argv_string.slice(0,
-argv_string.split(" ").slice(-1).join().length).trim();
// now get the host string and the port
host = argv_string.split(" ").slice(-1).join();
port = +argv_string.split(" ").slice(-2, -1).join();
pdgui.connect_as_client_to_secondary_instance(host, port,
pd_engine_id); pd_engine_id);
} }
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment