summaryrefslogtreecommitdiff
path: root/UFileAssoc.pas
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@users.sourceforge.net>2008-08-21 22:20:07 +0200
committerTomas Bzatek <tbzatek@users.sourceforge.net>2008-08-21 22:20:07 +0200
commitf8012d552a33d5615e5711c82bf22bc3bcdc3d23 (patch)
treee6954a34a5a83ff108d310e32ba5aee1f1c19345 /UFileAssoc.pas
parent4c57ea157b3ee4b9d9b9716c27a538540b73fcd9 (diff)
downloadtuxcmd-f8012d552a33d5615e5711c82bf22bc3bcdc3d23.tar.xz
Fix multiple extensions recognitionv0.6.46
Diffstat (limited to 'UFileAssoc.pas')
-rw-r--r--UFileAssoc.pas12
1 files changed, 5 insertions, 7 deletions
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