1 package WinProjectBase
;
3 # ************************************************************
4 # Description : A Windows base module for Project Creators
5 # Author : Chad Elliott
6 # Create Date : 1/4/2005
7 # ************************************************************
9 # ************************************************************
11 # ************************************************************
17 @ISA = qw(WinPropertyBase);
19 # ************************************************************
21 # ************************************************************
23 my $max_win_env = 'MPC_MAX_WIN_FILE_LENGTH';
25 # ************************************************************
27 # ************************************************************
35 sub case_insensitive
{
41 sub translate_directory
{
44 ## Call the base class version
45 $dir = $self->DirectoryManager::translate_directory
($dir);
47 ## Change drive letters and $() macros
48 $dir =~ s/^([A-Z]):/$1/i;
49 $dir =~ s/\$\(([^\)]+)\)/$1/g;
51 ## We need to make sure that we do not exceed the maximum file name
52 ## limitation (including the cwd (- c:\) and object file name). So, we
53 ## check the total length against a predetermined "acceptable" value.
54 ## This acceptable value is modifiable through the environment.
55 my $maxenv = $ENV{$max_win_env};
56 my $maxlen = (defined $maxenv && $maxenv =~ /^\d+$/ ?
$maxenv : 128) + 3;
57 my $dirlen = length($dir);
58 my $diff = (length($self->getcwd()) + $dirlen + 1) - $maxlen;
61 if ($diff > $dirlen) {
62 $dir = substr($dir, $dirlen - 1);
65 $dir = substr($dir, $diff);
67 while($dir =~ s/^\\//) {
75 sub validated_directory
{
78 ## $(...) could contain a drive letter and Windows can not
79 ## make a directory that resembles a drive letter. So, we have
80 ## to exclude those directories with $(...).
81 if ($dir =~ /\$\([^\)]+\)/ || $dir =~ /\.\.\\/ || $dir =~ /^[A-Z]:/i) {
91 return $_[0]->windows_crlf();
95 sub get_cmdsep_symbol
{
105 return lc($_[1]) cmp lc($_[2]);