Skip to content

Commit

Permalink
bugfix for Windows: Cannot find module
Browse files Browse the repository at this point in the history
  • Loading branch information
jgadsden committed Sep 10, 2021
2 parents d6dd36c + 09e3ab8 commit 0508ebd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion td.desktop/app/welcome/welcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

function welcome($scope, $location, $route, common, electron, threatmodellocator) {

const path = require('path');
const log = electron.log;
const logID = 'Welcome Controller: ';
log.debug(logID + 'loaded with verbosity level:', electron.logLevel);
Expand Down Expand Up @@ -47,7 +48,9 @@ function welcome($scope, $location, $route, common, electron, threatmodellocator

function openNewModel(template) {
log.debug(logID + 'open new model:', template);
var model = require('../../ThreatDragonModels/' + template + '/' + template + '.json');
var modelPath = path.join('..', '..', 'ThreatDragonModels', template, template + '.json');
var model = require(modelPath);
log.silly(logID + 'open new model path:', modelPath);
var success = true;
electron.dialog.save(function (fileName) {
fs.writeFileSync( fileName, JSON.stringify(model), 'utf8', function (err) {
Expand Down

0 comments on commit 0508ebd

Please sign in to comment.