Trim fname to fix cases of dbl dirsep under win

This commit is contained in:
Basile Burg 2018-03-17 05:17:11 +01:00
parent b093cb3a9c
commit 76d3fdafc2
2 changed files with 5 additions and 5 deletions

View File

@ -5,7 +5,7 @@ unit ce_dcd;
interface interface
uses uses
Classes, SysUtils, process, forms, strutils, Classes, SysUtils, process, forms, strutils, LazFileUtils,
{$IFDEF WINDOWS} {$IFDEF WINDOWS}
windows, windows,
{$ENDIF} {$ENDIF}
@ -589,7 +589,7 @@ begin
if i = -1 then if i = -1 then
exit; exit;
loc := str[i+1..str.length]; loc := str[i+1..str.length];
fname := str[1..i-1]; fname := TrimFilename(str[1..i-1]);
loc := ReplaceStr(loc, LineEnding, ''); loc := ReplaceStr(loc, LineEnding, '');
position := strToIntDef(loc, -1); position := strToIntDef(loc, -1);
end; end;

View File

@ -6,7 +6,7 @@ interface
uses uses
Classes, SysUtils, FileUtil, Forms, Controls, lcltype, Graphics, SynEditKeyCmds, Classes, SysUtils, FileUtil, Forms, Controls, lcltype, Graphics, SynEditKeyCmds,
ComCtrls, SynEditHighlighter, ExtCtrls, Menus, SynMacroRecorder, dialogs, ComCtrls, SynEditHighlighter, ExtCtrls, Menus, SynMacroRecorder, dialogs, LazFileUtils,
SynPluginSyncroEdit, SynEdit, SynHighlighterMulti, ce_dialogs, SynPluginSyncroEdit, SynEdit, SynHighlighterMulti, ce_dialogs,
ce_widget, ce_interfaces, ce_synmemo, ce_dlang, ce_common, ce_dcd, ce_observer, ce_widget, ce_interfaces, ce_synmemo, ce_dlang, ce_common, ce_dcd, ce_observer,
ce_sharedres, ce_controls, ce_writableComponent, ce_dsgncontrols; ce_sharedres, ce_controls, ce_writableComponent, ce_dsgncontrols;
@ -561,7 +561,7 @@ begin
for i := 0 to PageControl.PageCount-1 do for i := 0 to PageControl.PageCount-1 do
begin begin
result := getDocument(i); result := getDocument(i);
if SameFileName(result.fileName, fname) then if SameFileName(result.fileName, TrimFilename(fname)) then
exit; exit;
end; end;
result := nil; result := nil;
@ -579,7 +579,7 @@ begin
exit; exit;
end; end;
doc := TCESynMemo.Create(nil); doc := TCESynMemo.Create(nil);
fDoc.loadFromFile(fname); fDoc.loadFromFile(TrimFilename(fname));
if assigned(fProj) and (fProj.filename = fDoc.fileName) then if assigned(fProj) and (fProj.filename = fDoc.fileName) then
begin begin
if fProj.getFormat = pfCE then if fProj.getFormat = pfCE then