Subversion Repositories DevTools

Rev

Rev 4074 | Rev 4192 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4074 Rev 4097
Line 8... Line 8...
8
#       CSHARP for Windows
8
#       CSHARP for Windows
9
#
9
#
10
#............................................................................#
10
#............................................................................#
11
use strict;
11
use strict;
12
use warnings;
12
use warnings;
-
 
13
use File::Basename;
-
 
14
use File::Spec::Functions;
13
use MakeEntry;
15
use MakeEntry;
14
 
16
 
15
#
17
#
16
#   External data
18
#   External data
17
#
19
#
Line 244... Line 246...
244
# Description     : Internal function to assist in the creation of a resource
246
# Description     : Internal function to assist in the creation of a resource
245
#                   In many cases it will create an entry for later processing
247
#                   In many cases it will create an entry for later processing
246
#
248
#
247
# Inputs          : $subdir         - Root of the target directory for the generated
249
# Inputs          : $subdir         - Root of the target directory for the generated
248
#                                     resource file
250
#                                     resource file
249
#                   $src            - Path to the sorce resource file
251
#                   $src            - Path to the source resource file
250
#
252
#
251
# Returns         : Path to the generated resource file
253
# Returns         : Path to the generated resource file
252
#                   This will be FQN named file
254
#                   This will be FQN named file
253
#                   Path to the associated .CS file
255
#                   Path to the associated .CS file
254
#
256
#
Line 271... Line 273...
271
{
273
{
272
    my ($subdir, $src ) = @_;
274
    my ($subdir, $src ) = @_;
273
 
275
 
274
    #
276
    #
275
    #   Ensure that the .cs file also exists
277
    #   Ensure that the .cs file also exists
-
 
278
    #   We may have a NAME.Designer.cs or a NAME.cs file - Different VS versions do it differently
-
 
279
    #   The file 'should' be in the same directory, but may be in the parent
276
    #
280
    #
-
 
281
    my $csfile;
277
    (my $csfile = $src) =~ s~\.resx$~.cs~;
282
    my @csNames = qw(.Designer.cs .cs);
278
    (my $designerfile = $src) =~ s~\.resx$~.Designer.cs~;
283
    my @csDirs = qw( . ..);
279
 
-
 
280
    $csfile = $designerfile if ( -f $designerfile && -s $designerfile);
284
    my($csfilename, $csdirectories, $cssuffix) = fileparse($src, '.resx');
281
 
285
    csScan:
-
 
286
    foreach my $dir (@csDirs){
-
 
287
        foreach my $name (@csNames) {
282
    Warning ("$toolset_name toolset: Resx File without a .cs or Designer.cs file",
288
            my $testPath = catfile($csdirectories, $dir ,$csfilename . $name);
-
 
289
            if (-f $testPath)
-
 
290
            {
283
           "File: $src") unless ( -f $csfile );
291
                $csfile = $testPath;
-
 
292
                $csfile =~ s~\\~/~g;
-
 
293
                last csScan;
-
 
294
            }
-
 
295
        }
-
 
296
    }
284
 
297
 
-
 
298
    # Warn if we can't find one.
-
 
299
    # Create a dummy name - may fail later
-
 
300
    #
-
 
301
    unless ($csfile)
-
 
302
    {
-
 
303
        Warning ("$toolset_name toolset: Resx File without a .cs or Designer.cs file", "File: $src");
-
 
304
        ($csfile = $src) =~ s~\.resx$~.cs~;
-
 
305
    }
-
 
306
    
285
    #
307
    #
286
    #   Scan the .resx file looking for the ThisName element
308
    #   Scan the .resx file looking for the ThisName element
287
    #   A very simple and crude parser
309
    #   A very simple and crude parser
288
    #
310
    #
289
    my $ThisName;
311
    my $ThisName;