Skip to content

Commit da9b8df

Browse files
committed
nodeeditor windows path fixes
1 parent 7efe69f commit da9b8df

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/modules/nodeeditor/nodeeditor.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const swal = require('sweetalert');
88
const global = require("../../lib/global.js")
99
var fs = require('fs');
1010
const pythonFunction = require("../../lib/datafunctions");
11-
11+
const path = require('path');
1212

1313
$("#draw-sidebar-right").hide();
1414
$("#codenode-desc").hide();
@@ -19,7 +19,7 @@ let isSelected = false;
1919
let temparrow;
2020
let firstblock;
2121
let dir = global.projectDetails.name;
22-
let basepath = process.cwd() + "/../testing/Projects/";
22+
let basepath = path.join(process.cwd(), "/../testing/Projects/");
2323

2424
let graph = global.graph;
2525
graph.modelStage = new Konva.Stage({
@@ -33,7 +33,7 @@ stage.add(layer);
3333

3434

3535
if (!global.isLoaded.nodeeditor) {
36-
let graphdata = fs.readFileSync(basepath + dir + "/graph.json");
36+
let graphdata = fs.readFileSync(path.join(basepath, dir, "graph.json"));
3737
let savedGraph = JSON.parse(graphdata);
3838
let temphash = {};
3939

@@ -406,11 +406,11 @@ $("#goNext").click(function () {
406406
}
407407

408408
global.extraText += `
409-
tensorboard = TensorBoard(log_dir="../testing/Projects/${global.projectDetails.name}/logs/{}".format(asctime()), histogram_freq=0,write_graph=True,write_grads=True,write_images=True)
409+
tensorboard = TensorBoard(log_dir="../testing/Projects/${global.projectDetails.name}/logs/{}".format(asctime()).replace(":","-"), histogram_freq=0,write_graph=True,write_grads=True,write_images=True)
410410
411411
`
412412

413-
fs.writeFile(basepath + dir + "/editor.py", global.extraText + global.functionsText + global.modelText, 'utf-8', err => {
413+
fs.writeFile(path.join(basepath, dir, "editor.py"), global.extraText + global.functionsText + global.modelText, 'utf-8', err => {
414414
if (err) {
415415
swal("Saving Project", "Failed to save project.", "error");
416416
print("Error writing file", err);
@@ -443,7 +443,7 @@ function saveProject() {
443443
});
444444
});
445445

446-
fs.writeFile(basepath + dir + "/graph.json", JSON.stringify(data), 'utf-8', err => {
446+
fs.writeFile(path.join(basepath, dir, "graph.json"), JSON.stringify(data), 'utf-8', err => {
447447
if (err) {
448448
swal("Saving Project", "Failed to save project.", "error");
449449
print("Error writing file", err);

0 commit comments

Comments
 (0)