File tree 1 file changed +15
-1
lines changed 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,15 @@ public IntPtr MarshalManagedToNative(Object managedObj)
89
89
var expectedType = typeof ( FilePath ) ;
90
90
var actualType = managedObj . GetType ( ) ;
91
91
92
+ if ( actualType . FullName == expectedType . FullName )
93
+ {
94
+ var posixProperty = actualType . GetProperty ( "Posix" ) ;
95
+ if ( posixProperty != null && posixProperty . PropertyType == typeof ( string ) )
96
+ {
97
+ return FromManaged ( ( string ) posixProperty . GetValue ( managedObj , null ) ) ;
98
+ }
99
+ }
100
+
92
101
throw new MarshalDirectiveException (
93
102
string . Format ( CultureInfo . InvariantCulture ,
94
103
"FilePathMarshaler must be used on a FilePath. Expected '{0}' from '{1}'; received '{2}' from '{3}'." ,
@@ -110,7 +119,12 @@ public static IntPtr FromManaged(FilePath filePath)
110
119
return IntPtr . Zero ;
111
120
}
112
121
113
- return Utf8Marshaler . FromManaged ( filePath . Posix ) ;
122
+ return FromManaged ( filePath . Posix ) ;
123
+ }
124
+
125
+ private static IntPtr FromManaged ( string posixFilePath )
126
+ {
127
+ return Utf8Marshaler . FromManaged ( posixFilePath ) ;
114
128
}
115
129
116
130
public static FilePath FromNative ( IntPtr pNativeData )
You can’t perform that action at this time.
0 commit comments