Subversion Repositories gelsvn

Rev

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

Rev 107 Rev 217
Line 11... Line 11...
11
# ************************************************************
11
# ************************************************************
12
 
12
 
13
use strict;
13
use strict;
14
 
14
 
15
# ************************************************************
15
# ************************************************************
-
 
16
# Data Section
-
 
17
# ************************************************************
-
 
18
 
-
 
19
my($max_win_env) = 'MPC_MAX_WIN_FILE_LENGTH';
-
 
20
 
-
 
21
# ************************************************************
16
# Subroutine Section
22
# Subroutine Section
17
# ************************************************************
23
# ************************************************************
18
 
24
 
-
 
25
sub convert_slashes {
-
 
26
  #my($self) = shift;
-
 
27
  return 1;
-
 
28
}
-
 
29
 
-
 
30
 
-
 
31
sub case_insensitive {
-
 
32
  #my($self) = shift;
-
 
33
  return 1;
-
 
34
}
-
 
35
 
-
 
36
 
-
 
37
sub translate_directory {
-
 
38
  my($self) = shift;
-
 
39
  my($dir)  = shift;
-
 
40
 
-
 
41
  ## Call the base class version
-
 
42
  $dir = $self->DirectoryManager::translate_directory($dir);
-
 
43
 
-
 
44
  ## Change drive letters and $() macros
-
 
45
  $dir =~ s/^([A-Z]):/$1/i;
-
 
46
  $dir =~ s/\$\(([^\)]+)\)/$1/g;
-
 
47
 
-
 
48
  ## We need to make sure that we do not exceed the maximum file name
-
 
49
  ## limitation (including the cwd (- c:\) and object file name).  So, we
-
 
50
  ## check the total length against a predetermined "acceptable" value.
-
 
51
  ## This acceptable value is modifiable through the environment.
-
 
52
  my($maxenv) = $ENV{$max_win_env};
-
 
53
  my($maxlen) = (defined $maxenv && $maxenv =~ /^\d+$/ ? $maxenv : 128) + 3;
-
 
54
  my($dirlen) = length($dir);
-
 
55
  my($diff)   = (length($self->getcwd()) + $dirlen + 1) - $maxlen;
-
 
56
 
-
 
57
  if ($diff > 0) {
-
 
58
    if ($diff > $dirlen) {
-
 
59
      $dir = substr($dir, $dirlen - 1);
-
 
60
    }
-
 
61
    else {
-
 
62
      $dir = substr($dir, $diff);
-
 
63
    }
-
 
64
    while($dir =~ s/^\\//) {
-
 
65
    }
-
 
66
  }
-
 
67
 
-
 
68
  return $dir;
-
 
69
}
-
 
70
 
-
 
71
 
19
sub validated_directory {
72
sub validated_directory {
20
  my($self) = shift;
73
  my($self) = shift;
21
  my($dir)  = shift;
74
  my($dir)  = shift;
22
 
75
 
23
  ## $(...) could contain a drive letter and Windows can not
76
  ## $(...) could contain a drive letter and Windows can not
Line 37... Line 90...
37
  return $self->windows_crlf();
90
  return $self->windows_crlf();
38
}
91
}
39
 
92
 
40
 
93
 
41
sub file_sorter {
94
sub file_sorter {
42
  my($self)  = shift;
95
  #my($self)  = shift;
43
  my($left)  = shift;
96
  #my($left)  = shift;
44
  my($right) = shift;
97
  #my($right) = shift;
45
  return lc($left) cmp lc($right);
98
  return lc($_[1]) cmp lc($_[2]);
46
}
99
}
47
 
100
 
48
 
101
 
49
1;
102
1;