Remove test/protos symlink, use window.PROTO_ROOT for config

This commit is contained in:
Scott Nonnenberg 2017-05-17 18:01:33 -07:00
parent f4aa6d93a7
commit 3a3aa3efb6
No known key found for this signature in database
GPG key ID: A4931C09644C654B
6 changed files with 27 additions and 14 deletions

View file

@ -37095,11 +37095,18 @@ Internal.SessionLock.queueJobForNumber = function queueJobForNumber(number, runJ
window.textsecure.protobuf = {};
function loadProtoBufs(filename) {
return dcodeIO.ProtoBuf.loadProtoFile({root: 'protos', file: filename}, function(error, result) {
var protos = result.build('textsecure');
for (var protoName in protos) {
textsecure.protobuf[protoName] = protos[protoName];
}
return dcodeIO.ProtoBuf.loadProtoFile({root: window.PROTO_ROOT, file: filename}, function(error, result) {
if (error) {
throw error;
}
var protos = result.build('textsecure');
if (!protos) {
var text = 'Error loading protos from ' + filename + ' (root: ' + window.PROTO_ROOT + ')';
throw new Error(text);
}
for (var protoName in protos) {
textsecure.protobuf[protoName] = protos[protoName];
}
});
};

View file

@ -4,14 +4,18 @@
window.textsecure.protobuf = {};
function loadProtoBufs(filename) {
return dcodeIO.ProtoBuf.loadProtoFile({root: 'protos', file: filename}, function(error, result) {
if (error) {
throw error;
}
var protos = result.build('textsecure');
for (var protoName in protos) {
textsecure.protobuf[protoName] = protos[protoName];
}
return dcodeIO.ProtoBuf.loadProtoFile({root: window.PROTO_ROOT, file: filename}, function(error, result) {
if (error) {
throw error;
}
var protos = result.build('textsecure');
if (!protos) {
var text = 'Error loading protos from ' + filename + ' (root: ' + window.PROTO_ROOT + ')';
throw new Error(text);
}
for (var protoName in protos) {
textsecure.protobuf[protoName] = protos[protoName];
}
});
};

View file

@ -3,6 +3,7 @@
console.log('preload');
const electron = require('electron')
window.PROTO_ROOT = 'protos';
window.config = require('url').parse(window.location.toString(), true).query;
const ipc = electron.ipcRenderer

View file

@ -3,6 +3,7 @@
*/
mocha.setup("bdd");
window.assert = chai.assert;
window.PROTO_ROOT = '../protos';
(function() {
var OriginalReporter = mocha._reporter;

View file

@ -1 +0,0 @@
../protos/

View file

@ -12215,6 +12215,7 @@ Library.prototype.test = function(obj, type) {
*/
mocha.setup("bdd");
window.assert = chai.assert;
window.PROTO_ROOT = '../protos';
(function() {
var OriginalReporter = mocha._reporter;