summaryrefslogtreecommitdiff
path: root/UFileAssoc.pas
diff options
context:
space:
mode:
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