Browse Source

* Fix finding resource by name

Michael VAN CANNEYT 2 years ago
parent
commit
a74f4a8960
1 changed files with 10 additions and 4 deletions
  1. 10 4
      rtl/objpas/classes/streams.inc

+ 10 - 4
rtl/objpas/classes/streams.inc

@@ -1879,10 +1879,16 @@ procedure TResourceStream.Initialize(Instance: TFPResourceHMODULE; Name, ResType
   end;
 
 constructor TResourceStream.Create(Instance: TFPResourceHMODULE; const ResName: string; ResType: PAnsiChar);
-  begin
-    inherited create;
-    Initialize(Instance,PAnsiChar(ResName),ResType,False);
-  end;
+
+Var
+  S : AnsiString {$IF SIZEOF(CHAR)=1} absolute Resname {$endif} ;
+
+begin
+  inherited create;
+  // fpcres seems to use default translations...
+  {$IF SIZEOF(CHAR)=2}S:=ResName;{$endif}
+  Initialize(Instance,PAnsiChar(S),ResType,False);
+end;
 constructor TResourceStream.CreateFromID(Instance: TFPResourceHMODULE; ResID: Integer; ResType: PAnsiChar);
   begin
     inherited create;