Index: src/errors.c
===================================================================
RCS file: /cvs/hugs98/src/errors.c,v
retrieving revision 1.8
diff -u -r1.8 errors.c
--- src/errors.c	4 Sep 2005 15:16:37 -0000	1.8
+++ src/errors.c	4 Oct 2005 14:26:07 -0000
@@ -75,13 +75,8 @@
 	setLastEdit(scriptFile,l);
 #ifdef HUGS_FOR_WINDOWS
 	{
-	    char buf[1000];
 	    FPrintf(errorStream," ");
-	    if (l)
-		sprintf(buf,"file:%s:%d",scriptFile,l);
-	    else
-		sprintf(buf,"file:%s",scriptFile);
-	    WinHugsHyperlink(buf);
+	    WinHugsFilename(scriptFile, l);
 	}
 #else
 	FPrintf(errorStream," \"%s\"",scriptFile);
Index: src/script.c
===================================================================
RCS file: /cvs/hugs98/src/script.c,v
retrieving revision 1.15
diff -u -r1.15 script.c
--- src/script.c	2 Sep 2005 13:56:09 -0000	1.15
+++ src/script.c	4 Oct 2005 14:36:03 -0000
@@ -377,10 +377,8 @@
     Printf("\nHugs session for:");
     for (i=0; i<numScripts; ++i) {
 #if HUGS_FOR_WINDOWS
-	char buf[1000];
 	Putchar('\n');
-	sprintf(buf, "file:%s", scriptTable[i].fileName);
-	WinHugsHyperlink(buf);
+	WinHugsFilename(scriptTable[i].fileName, 0);
 #else
 	Printf("\n%s",scriptTable[i].fileName);
 #endif
Index: src/winhugs/General.c
===================================================================
RCS file: /cvs/hugs98/src/winhugs/General.c,v
retrieving revision 1.1
diff -u -r1.1 General.c
--- src/winhugs/General.c	1 Sep 2005 12:22:19 -0000	1.1
+++ src/winhugs/General.c	4 Oct 2005 14:51:43 -0000
@@ -91,6 +91,7 @@
 {
     if (strncmp(FileName, "file:", 5) == 0) {
 	//find the line number
+        char Buffer[MAX_PATH];
 	char* s = strrchr(FileName, ':');
 	int LineNo;
 	if (s != NULL) {
@@ -111,7 +112,21 @@
 	    LineNo = atoi(s);
 	}
 
-	startEdit(LineNo, &FileName[5]);
+	FileName = &FileName[5];
+	if (strncmp("{Hugs}", FileName, 6) == 0)
+	{
+	    strcpy(Buffer, hugsdir());
+	    strcat(Buffer, &FileName[6]);
+	}
+	else if (FileName[0] == '.')
+	{
+	    GetCurrentDirectory(MAX_PATH, Buffer);
+	    strcat(Buffer, &FileName[1]);
+	}
+	else
+	    strcpy(Buffer, FileName);
+
+	startEdit(LineNo, Buffer);
     } else {
 	int Res = (int) ShellExecute(hThisWindow, NULL, FileName, NULL, NULL, SW_SHOWNORMAL);
 	if (Res <= 32) {
Index: src/winhugs/IORemap.c
===================================================================
RCS file: /cvs/hugs98/src/winhugs/IORemap.c,v
retrieving revision 1.3
diff -u -r1.3 IORemap.c
--- src/winhugs/IORemap.c	8 Sep 2005 16:17:49 -0000	1.3
+++ src/winhugs/IORemap.c	4 Oct 2005 14:48:40 -0000
@@ -2,6 +2,10 @@
 #include <stdio.h>
 #include "Winhugs.h"
 
+#include <prelude.h>
+#include <storage.h>
+#include <connect.h>
+
 // stdstr output definitions
 #define MAX_STDSTR 1024
 int     StrInx = 0;
@@ -150,3 +154,36 @@
     else
 	return fgetc(f);
 }
+
+void WinHugsFilename(const char* FileName, int LineNo)
+{
+    LPCTSTR HugsDir = hugsdir();
+    int nHugsDir = strlen(HugsDir);
+    int nCurDir;
+    char Buffer[MAX_PATH], CurDir[MAX_PATH];
+    nCurDir = GetCurrentDirectory(MAX_PATH, CurDir);
+
+    strcpy(Buffer, "file:");
+
+    if (strncmp(HugsDir, FileName, nHugsDir) == 0)
+    {
+	strcat(Buffer, "{Hugs}");
+	strcat(Buffer, &FileName[nHugsDir]);
+    }
+    else if (strnicmp(CurDir, FileName, nCurDir) == 0)
+    {
+	strcat(Buffer, ".");
+	strcat(Buffer, &FileName[nCurDir]);
+    }
+    else
+	strcat(Buffer, FileName);
+
+    if (LineNo)
+    {
+	int n = strlen(Buffer);
+	Buffer[n] = ':';
+	itoa(LineNo, &Buffer[1], 10);
+    }
+
+    WinHugsHyperlink(Buffer);
+}
Index: src/winhugs/Winhugs.h
===================================================================
RCS file: /cvs/hugs98/src/winhugs/Winhugs.h,v
retrieving revision 1.15
diff -u -r1.15 Winhugs.h
--- src/winhugs/Winhugs.h	16 Sep 2005 16:55:10 -0000	1.15
+++ src/winhugs/Winhugs.h	4 Oct 2005 14:35:24 -0000
@@ -54,6 +54,7 @@
 extern int	WinHugsPutC(FILE* f, char c);
 extern int	WinHugsGetC(FILE* f);
 extern void	WinHugsHyperlink(const char* msg);
+extern void     WinHugsFilename(const char* FileName, int LineNo);
 
 // undefine everything that is a macro already
 #undef getc
