Subversion Repositories DevTools

Rev

Rev 2930 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2930 Rev 3925
Line 51... Line 51...
51
 
51
 
52
#
52
#
53
#   Globals
53
#   Globals
54
#
54
#
55
my $Name            = 'BeyondCompare';
55
my $Name            = 'BeyondCompare';
56
my $DiffProg        = 'c:/Program Files/Beyond Compare 2/BC2.exe';
56
my $DiffProg;
57
my @DiffArgs;
57
my @DiffArgs;
58
my $DiffWait;
58
my $DiffWait;
59
my @view_tags;
59
my @view_tags;
60
my @view_commands;
60
my @view_commands;
61
my @cleanFiles;
61
my @cleanFiles;
Line 135... Line 135...
135
{
135
{
136
    $opt_mode = 'bc2';
136
    $opt_mode = 'bc2';
137
    $DiffWait = 1;
137
    $DiffWait = 1;
138
 
138
 
139
    #
139
    #
140
    #   Determine the path to BC2.EXE
140
    #   Determine the path to Beyond Compare Exe
141
    #   It may not be installed in the default place
141
    #       It may not be installed in the default place, but the Windows
-
 
142
    #       registry will know where it is
142
    #
143
    #
143
    if ( ! -x $DiffProg )
-
 
144
    {
-
 
145
        $DiffProg = GetBc2ExePath();
144
    GetBeyondCompareExePath();
146
    }
-
 
147
}
145
}
148
 
146
 
149
#
147
#
150
#   Validate user options
148
#   Validate user options
151
#
149
#
Line 378... Line 376...
378
        $tpath .= $dir;
376
        $tpath .= $dir;
379
    }
377
    }
380
}
378
}
381
 
379
 
382
#-------------------------------------------------------------------------------
380
#-------------------------------------------------------------------------------
383
# Function        : GetBc2ExePath
381
# Function        : GetBeyondCompareExePath
384
#
382
#
385
# Description     : Determine the path to the BeyondCompare executable
383
# Description     : Determine the path to the BeyondCompare executable
386
#                   by looking in the Windows Registry
384
#                   by looking in the Windows Registry
387
#
385
#
388
# Inputs          : None
386
# Inputs          : None
389
#
387
#
390
# Returns         : Path to an executable
388
# Returns         : Path to an executable
391
#
389
#
392
 
390
 
393
sub GetBc2ExePath
391
sub GetBeyondCompareExePath
394
{
392
{
395
    eval "require Win32::TieRegistry"
393
    eval "require Win32::TieRegistry"
396
        or Error ("Win32::TieRegistry not available");
394
        or Error ("Win32::TieRegistry not available");
397
 
395
 
398
    my $userKey= Win32::TieRegistry->new("CUser")
396
    my $userKey= Win32::TieRegistry->new("CUser")
399
        or  Error( "Can't access HKEY_CURRENT_USER key: $^E" );
397
        or  Error( "Can't access HKEY_CURRENT_USER key: $^E" );
400
 
398
 
-
 
399
    my $bcKey;
401
    my $bc2Key= $userKey->Open( "Software/Scooter Software/Beyond Compare", {Delimiter=>"/"} )
400
    if ($bcKey = $userKey->Open( "Software/Scooter Software/Beyond Compare 3", {Delimiter=>"/"} ))
-
 
401
    {
-
 
402
        Verbose("Using BC3");
-
 
403
        push @DiffArgs, '/solo';
-
 
404
    }
-
 
405
    elsif ($bcKey = $userKey->Open( "Software/Scooter Software/Beyond Compare", {Delimiter=>"/"} ))
-
 
406
    {
-
 
407
        Verbose("Using BC2");
-
 
408
    }
-
 
409
    else
-
 
410
    {
402
        or  Error "Can't access BC2 Keys: $^E";
411
        Error "Can't access BC2 or BC3 Keys: $^E";
-
 
412
    }
403
 
413
 
404
    my $bc2Data = $bc2Key->GetValue( 'ExePath' )
414
    $DiffProg = $bcKey->GetValue( 'ExePath' )
405
        or Error( "Cannot locate BeyondCompare in Windows Registry");
415
        or Error( "Cannot locate BeyondCompare ExePath in Windows Registry");
406
 
416
 
407
    Error ("BeyondCompare program not found", "Prog: $bc2Data") unless ( -x $bc2Data );
417
    Error ("BeyondCompare program not found", "Prog: $DiffProg")
408
    return $bc2Data;
418
        unless ( -x $DiffProg );
409
}
419
}
410
 
420
 
411
#-------------------------------------------------------------------------------
421
#-------------------------------------------------------------------------------
412
# Function        : END
422
# Function        : END
413
#
423
#