summaryrefslogtreecommitdiff
path: root/UFileAssoc.pas
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@tbzatek.englab.brq.redhat.com>2008-08-22 10:41:31 +0200
committerTomas Bzatek <tbzatek@tbzatek.englab.brq.redhat.com>2008-08-22 10:41:31 +0200
commitb5af37db7650be18ac54c8ca7fe3cf476a2315ee (patch)
tree55720d7b523352dac330e849a54683ba89dcfbf7 /UFileAssoc.pas
parent16550e8c907165d1305fc4b58f2b05554ea671a0 (diff)
parentf8012d552a33d5615e5711c82bf22bc3bcdc3d23 (diff)
downloadtuxcmd-b5af37db7650be18ac54c8ca7fe3cf476a2315ee.tar.xz
Merge branch 'master' of ssh://tomas@git.bzatek.net/projects/git/tuxcmd
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