File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,16 @@ 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
+ var reflectedFilePath = ( string ) posixProperty . GetValue ( managedObj , null ) ;
98
+ return FromManaged ( reflectedFilePath ) ;
99
+ }
100
+ }
101
+
92
102
throw new MarshalDirectiveException (
93
103
string . Format ( CultureInfo . InvariantCulture ,
94
104
"FilePathMarshaler must be used on a FilePath. Expected '{0}' from '{1}'; received '{2}' from '{3}'." ,
@@ -110,7 +120,12 @@ public static IntPtr FromManaged(FilePath filePath)
110
120
return IntPtr . Zero ;
111
121
}
112
122
113
- return Utf8Marshaler . FromManaged ( filePath . Posix ) ;
123
+ return FromManaged ( filePath . Posix ) ;
124
+ }
125
+
126
+ private static IntPtr FromManaged ( string posixFilePath )
127
+ {
128
+ return Utf8Marshaler . FromManaged ( posixFilePath ) ;
114
129
}
115
130
116
131
public static FilePath FromNative ( IntPtr pNativeData )
You can’t perform that action at this time.
0 commit comments