From 755039bb3ca7a92a567485af118a0903557af469 Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <quaritsch@ivt.tugraz.at>
Date: Thu, 16 Feb 2023 16:09:45 +0100
Subject: [PATCH] fix handling paths in engine and EM form

---
 VECTO/GUI/ElectricMotorForm.vb | 2 +-
 VECTO/GUI/EngineForm.vb        | 9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/VECTO/GUI/ElectricMotorForm.vb b/VECTO/GUI/ElectricMotorForm.vb
index 0b38115a2c..215b0dede9 100644
--- a/VECTO/GUI/ElectricMotorForm.vb
+++ b/VECTO/GUI/ElectricMotorForm.vb
@@ -214,7 +214,7 @@ Public Class ElectricMotorForm
         ElectricMotorFileBrowser.UpdateHistory(file)
         Text = GetFilenameWithoutPath(file, True)
         LbStatus.Text = ""
-        _emFile = file
+        _emFile = Path.GetFullPath(file)
         Activate()
 
         _changed = False
diff --git a/VECTO/GUI/EngineForm.vb b/VECTO/GUI/EngineForm.vb
index 197c1c1a39..1503723a68 100644
--- a/VECTO/GUI/EngineForm.vb
+++ b/VECTO/GUI/EngineForm.vb
@@ -235,7 +235,7 @@ Public Class EngineForm
 			End Select
 		End If
 
-		Dim basePath As String = Path.GetDirectoryName(file)
+		Dim basePath As String = path.GetDirectoryName(Path.GetFullPath(file))
 		TbName.Text = engine.Model
 		TbDispl.Text = (engine.Displacement.Value() * 1000.0 * 1000).ToGUIFormat()
 		TbInertia.Text = engine.Inertia.ToGUIFormat()
@@ -323,7 +323,7 @@ Public Class EngineForm
 		EngineFileBrowser.UpdateHistory(file)
 		Text = GetFilenameWithoutPath(file, True)
 		LbStatus.Text = ""
-		_engFile = file
+		_engFile = Path.GetFullPath(file)
 		Activate()
 
 		_changed = False
@@ -410,8 +410,9 @@ Public Class EngineForm
 
 		If AutoSendTo Then
 			If VectoJobForm.Visible Then
-				If UCase(FileRepl(VectoJobForm.TbENG.Text, JobDir)) <> UCase(file) Then _
-					VectoJobForm.TbENG.Text = GetFilenameWithoutDirectory(file, JobDir)
+				If UCase(FileRepl(VectoJobForm.TbENG.Text, JobDir)) <> UCase(file) Then 
+					VectoJobForm.TbENG.Text = GetRelativePath(file, JobDir)
+				end if
 				VectoJobForm.UpdatePic()
 			End If
 		End If
-- 
GitLab