From f8012d552a33d5615e5711c82bf22bc3bcdc3d23 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Thu, 21 Aug 2008 22:20:07 +0200 Subject: Fix multiple extensions recognition --- UConfig.pas | 4 ++-- UFileAssoc.pas | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/UConfig.pas b/UConfig.pas index 98c1938..f66c732 100644 --- a/UConfig.pas +++ b/UConfig.pas @@ -25,8 +25,8 @@ uses Classes, ULocale; resourcestring ConstAppTitle = 'Tux Commander'; - ConstAboutVersion = '0.6.45-dev'; - ConstAboutBuildDate = '2008-06-18'; + ConstAboutVersion = '0.6.46-dev'; + ConstAboutBuildDate = '2008-08-21'; {$IFDEF FPC} {$INCLUDE fpcver.inc} diff --git a/UFileAssoc.pas b/UFileAssoc.pas index 10d0f73..923ecac 100644 --- a/UFileAssoc.pas +++ b/UFileAssoc.pas @@ -21,7 +21,7 @@ unit UFileAssoc; interface -uses Classes, SysUtils, GTKPixbuf, GTKClasses, GTKUtils, UEngines, UVFSCore, UCoreUtils; +uses Classes, SysUtils, StrUtils, GTKPixbuf, GTKClasses, GTKUtils, UEngines, UVFSCore, UCoreUtils; type TAssocAction = class ActionName, ActionCommand: string; @@ -164,9 +164,8 @@ end; function FindVFSPlugin(Filename: string): TVFSPlugin; var Ext, s: string; b: boolean; - i, j, Last, MaxFound: integer; + i, j, MaxFound: integer; begin - b := False; Result := nil; MaxFound := 0; if (Pos('.', Filename) > 1) and (LastDelimiter('.', Filename) < Length(Filename)) then begin @@ -181,7 +180,7 @@ begin s := ANSIUpperCase(IncludeLeadingDot(Extensions[j])); if Length(Ext) = Length(s) then b := (Ext = s) and (Length(s) > MaxFound) - else b := (Pos(s, Ext) > 0) and (Pos(s, Ext) = (Length(Ext) - Length(s) + 1)) and (Length(s) > MaxFound); + else b := (Pos(s, Ext) > 0) and (RightStr(Ext, Length(s)) = s) and (Length(s) > MaxFound); if b then Break; end; if b then begin @@ -195,9 +194,8 @@ end; function FindAssoc(Filename: string): TFileAssoc; var Ext, s: string; b: boolean; - i, j, Last, MaxFound: integer; + i, j, MaxFound: integer; begin - b := False; Result := nil; MaxFound := 0; if (Pos('.', Filename) > 1) and (LastDelimiter('.', Filename) < Length(Filename)) then begin @@ -212,7 +210,7 @@ begin s := ANSIUpperCase(IncludeLeadingDot(Extensions[j])); if Length(Ext) = Length(s) then b := (Ext = s) and (Length(s) > MaxFound) - else b := (Pos(s, Ext) > 0) and (Pos(s, Ext) = (Length(Ext) - Length(s) + 1)) and (Length(s) > MaxFound); + else b := (Pos(s, Ext) > 0) and (RightStr(Ext, Length(s)) = s) and (Length(s) > MaxFound); if b then Break; end; if b then begin -- cgit v1.2.3