1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
Index: compiler/comprsrc.pas
===================================================================
--- compiler/comprsrc.pas (revision 12548)
+++ compiler/comprsrc.pas (working copy)
@@ -110,16 +110,31 @@
else
SelectBin:=Bin2;
end;
-
+
+ function WindresFileName(filename: TCmdStr): TCmdStr;
+ // to be on the safe side, only give short file names with forward slashes to
+ // windres
+ var
+ i: longint;
+ begin
+ Result := GetShortName(filename);
+ for I:=1 to Length(Result) do
+ if Result[I] in AllowDirectorySeparators then
+ Result[i]:='/';
+ end;
+
var
respath,
srcfilepath,
preprocessorbin,
s,
bin,
- resbin : TCmdStr;
+ resbin,
+ fnameparam : TCmdStr;
+ usewindres,
resfound,
objused : boolean;
+
begin
if output=roRES then
Bin:=SelectBin(RCCompiler,target_res.rcbin)
@@ -128,6 +143,7 @@
if bin='' then
exit;
resfound:=false;
+ usewindres:= bin='windres';
if utilsdirectory<>'' then
resfound:=FindFile(utilsprefix+bin+source_info.exeext,utilsdirectory,false,resbin);
if not resfound then
@@ -140,11 +156,15 @@
current_settings.globalswitches:=current_settings.globalswitches+[cs_link_nolink];
end;
srcfilepath:=ExtractFilePath(current_module.mainsource^);
+ if usewindres then
+ fnameparam:=WindresFileName(fname)
+ else
+ fnameparam:=maybequoted(fname);
if output=roRES then
begin
s:=target_res.rccmd;
Replace(s,'$RES',maybequoted(OutName));
- Replace(s,'$RC',maybequoted(fname));
+ Replace(s,'$RC',fnameparam);
ObjUsed:=False;
end
else
@@ -152,20 +172,23 @@
s:=target_res.rescmd;
ObjUsed:=(pos('$OBJ',s)>0);
Replace(s,'$OBJ',maybequoted(OutName));
- Replace(s,'$RES',maybequoted(fname));
+ Replace(s,'$RES',fnameparam);
end;
{ windres doesn't like empty include paths }
if respath='' then
respath:='.';
- Replace(s,'$INC',maybequoted(respath));
+ if usewindres then
+ Replace(s,'$INC',WindresFileName(respath))
+ else
+ Replace(s,'$INC',maybequoted(respath));
if (target_res.resbin='windres') then
begin
if (srcfilepath<>'') then
- s:=s+' --include '+maybequoted(srcfilepath);
+ s:=s+' --include '+WindresFileName(srcfilepath);
{ try to find a preprocessor }
preprocessorbin := respath+'cpp'+source_info.exeext;
if FileExists(preprocessorbin,true) then
- s:=s+' --preprocessor='+preprocessorbin;
+ s:=s+' --preprocessor='+maybequoted(preprocessorbin);
end;
{ Execute the command }
if not (cs_link_nolink in current_settings.globalswitches) then
|