27
27
28
28
using System ;
29
29
using System . Xml ;
30
+ using System . IO ;
30
31
31
32
namespace Mono . Debugging . Client
32
33
{
@@ -50,11 +51,16 @@ public Breakpoint (string fileName, int line) : this (fileName, line, 1)
50
51
{
51
52
}
52
53
53
- internal Breakpoint ( XmlElement elem ) : base ( elem )
54
+ internal Breakpoint ( XmlElement elem , string baseDir ) : base ( elem , baseDir )
54
55
{
55
- string s = elem . GetAttribute ( "file" ) ;
56
- if ( ! string . IsNullOrEmpty ( s ) )
57
- fileName = s ;
56
+ string s = elem . GetAttribute ( "relfile" ) ;
57
+ if ( ! string . IsNullOrEmpty ( s ) && baseDir != null ) {
58
+ fileName = Path . Combine ( baseDir , s ) ;
59
+ } else {
60
+ s = elem . GetAttribute ( "file" ) ;
61
+ if ( ! string . IsNullOrEmpty ( s ) )
62
+ fileName = s ;
63
+ }
58
64
59
65
s = elem . GetAttribute ( "line" ) ;
60
66
if ( string . IsNullOrEmpty ( s ) || ! int . TryParse ( s , out line ) )
@@ -64,17 +70,22 @@ internal Breakpoint (XmlElement elem): base (elem)
64
70
if ( string . IsNullOrEmpty ( s ) || ! int . TryParse ( s , out column ) )
65
71
column = 1 ;
66
72
}
67
-
68
- internal override XmlElement ToXml ( XmlDocument doc )
73
+
74
+ internal override XmlElement ToXml ( XmlDocument doc , string baseDir )
69
75
{
70
- XmlElement elem = base . ToXml ( doc ) ;
71
-
72
- if ( ! string . IsNullOrEmpty ( fileName ) )
76
+ XmlElement elem = base . ToXml ( doc , baseDir ) ;
77
+
78
+ if ( ! string . IsNullOrEmpty ( fileName ) ) {
73
79
elem . SetAttribute ( "file" , fileName ) ;
74
-
80
+ if ( baseDir != null ) {
81
+ if ( fileName . StartsWith ( baseDir , StringComparison . Ordinal ) )
82
+ elem . SetAttribute ( "relfile" , fileName . Substring ( baseDir . Length ) . TrimStart ( Path . DirectorySeparatorChar ) ) ;
83
+ }
84
+ }
85
+
75
86
elem . SetAttribute ( "line" , line . ToString ( ) ) ;
76
87
elem . SetAttribute ( "column" , column . ToString ( ) ) ;
77
-
88
+
78
89
return elem ;
79
90
}
80
91
0 commit comments