1 # ======================================================================
3 # Copyright 2003, Sony Online Entertainment
5 # ======================================================================
10 # ======================================================================
11 # Perforce public variables.
12 # ======================================================================
14 # our $relativePathName;
16 # ======================================================================
17 # Setup variables that can be imported by Exporter into user modules.
18 # ======================================================================
20 use vars
qw(@ISA @EXPORT_OK $VERSION);
25 # These symbols are okay to export if specifically requested.
26 #@EXPORT_OK = qw(&buildFileLookupTable &saveFileLookupTable &loadFileLookupTable &getFullPathName);
27 @EXPORT_OK = qw(&findOnDiskFileName);
29 # ======================================================================
30 # Perforce private variables.
31 # ======================================================================
35 # ======================================================================
36 # Perforce public functions.
37 # ======================================================================
39 sub findOnDiskFileName
42 my $p4DepotFile = shift;
43 my $output = `p4 where $p4DepotFile`;
44 die "p4 where failed: [$?] [$output]" if ($?
!= 0);
46 # Split p4 where output into array. Assumes no spaces in paths.
47 my @outputInfo = split /\s+/,$output;
48 my $entryCount = @outputInfo;
49 die "expecting a non-zero, positive multiple of 3 items returned by p4 where, found $entryCount" if ($entryCount < 3) or (($entryCount % 3) != 0);
51 # Return on-disk location. The correct local client mapping will be
52 # the last entry of the final triplet returned by P4. Earlier triplets,
53 # if present, appear to be "not here" minus-style mappings indicating
54 # places where the file could have gone but was overridden by a client
55 # spec setting. That part doesn't appear to be documented in 'p4 help where'.
56 return $outputInfo[$entryCount - 1];
59 # ======================================================================
61 # Indicate the module loaded successfully.