sbsv1/abld/genutil/pathutl.pm
author lorewang
Thu, 11 Nov 2010 12:38:08 +0800
changeset 678 f0d451bf8bcb
parent 599 fa7a3cc6effd
permissions -rw-r--r--
update version info
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
599
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     1
# Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     2
# All rights reserved.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     3
# This component and the accompanying materials are made available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     4
# under the terms of "Eclipse Public License v1.0"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     5
# which accompanies this distribution, and is available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     6
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     7
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     8
# Initial Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     9
# Nokia Corporation - initial contribution.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    10
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    11
# Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    12
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    13
# Description:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    14
# General Path and File Utility Functions for use with Makmake
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    15
# Distinguish paths from filepaths by assuming paths end with "\"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    16
# therefore ensure this is the case for all paths coming into programs using this module
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    17
# 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    18
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    19
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    20
package Pathutl;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    21
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    22
require Exporter;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    23
@ISA=qw(Exporter);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    24
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    25
@EXPORT=qw(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    26
	Path_SetVerbose Path_Drive Path_WorkPath Path_RltToWork Path_AbsToWork
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    27
	Path_DelFiles Path_Split Path_Dirs Path_StepDirs Path_Strip 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    28
	Path_MakePathL Path_UpToRoot Path_MakeRlt Path_MakeAbs Path_Chop
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    29
	Path_MakeEAbs Path_Quote Path_MakeRltToBase Path_Norm Path_PrefixWithDrive Path_PrefixWithDriveAndQuote
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    30
);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    31
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    32
use Cwd;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    33
use File::Path;                # for mkpath
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    34
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    35
my %Mode=(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    36
	Verbose=>0
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    37
);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    38
my $Drive;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    39
my $WorkPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    40
my @WorkPathList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    41
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    42
sub Path_SetVerbose () {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    43
	$Mode{Verbose}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    44
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    45
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    46
sub Path_Drive () {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    47
# return the current drive - programs shouldn't change directory if using this module
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    48
	$Drive;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    49
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    50
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    51
sub Path_WorkPath () {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    52
# return the current working directory - programs shouldn't change directory if using this module
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    53
	$WorkPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    54
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    55
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    56
sub helper_MakeRlt ($@) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    57
# helper function for computing relative path(s) given a base path
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    58
	my ($BaseRef,@List)=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    59
	foreach my $p (@List) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    60
		my $filename=&Path_Split('File',$p);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    61
		my @plist=&Path_Dirs($p);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    62
		my $upcount=scalar @{$BaseRef};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    63
		foreach (@{$BaseRef}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    64
			if (uc $_ ne uc $plist[0]) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    65
				last;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    66
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    67
			$upcount -= 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    68
			shift @plist;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    69
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    70
		$p="";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    71
		while ($upcount-->0) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    72
			$p .= "..\\";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    73
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    74
		foreach (@plist) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    75
			$p .= "$_\\";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    76
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    77
		$p=".\\" if ($p eq "");		# ensure a well-formed result if path == work
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    78
		$p .= $filename;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    79
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    80
	return wantarray ? @List : $List[0];	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    81
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    82
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    83
sub Path_RltToWork (@) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    84
# make a path or list of paths relative to the current working directory
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    85
	my @List=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    86
	@List=&helper_MakeRlt(\@WorkPathList,@List);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    87
	return wantarray ? @List : $List[0];
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    88
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    89
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    90
sub Path_MakeRltToBase ($@) {	#args: $_[0] Base $_[1]... list of (Abs FilePath/Path)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    91
# make a path, or list of paths, relative to a particular directory specified by the first
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    92
# path passed into the function
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    93
	return undef unless $_[0]=~m-(|\\$)-o;	# allow for null value passed in
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    94
	my ($Base,@List)=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    95
	my @BasePathList=&Path_Dirs($Base);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    96
	@List=&helper_MakeRlt(\@BasePathList,@List);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    97
	return wantarray ? @List : $List[0];	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    98
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    99
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   100
sub Path_AbsToWork (@) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   101
# make a path or list of paths relative to the current working directory absolute
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   102
	my @List=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   103
	@List=&Path_MakeAbs($WorkPath,@List);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   104
	return wantarray ? @List : $List[0];	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   105
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   106
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   107
sub Path_DelFiles (@) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   108
# delete a list of files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   109
	my @List=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   110
	my $File;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   111
	foreach $File (@List) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   112
		if (unlink $File) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   113
			if ($Mode{Verbose}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   114
				print "Deleted File: \"$File\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   115
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   116
			next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   117
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   118
		if ($Mode{Verbose}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   119
			print "Not Found: \"$File\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   120
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   121
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   122
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   123
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   124
sub Path_Split ($$) {	#args: $_[0] 'Path' or 'Base' or 'Ext' $_[1] Abs/Rel FilePath/Path
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   125
# return the section of a file path required - Path, Base, Ext or File
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   126
	my ($Sect,$P)=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   127
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   128
	return '' if !$P;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   129
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   130
	$Sect= ucfirst lc $Sect;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   131
	if ($Sect eq 'Path') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   132
		if ($P=~/^(.*\\)/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   133
			return $1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   134
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   135
		return '';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   136
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   137
	if ($Sect eq 'Base') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   138
		if ($P=~/\\?([^\\]*?)(\.[^\\\.]*)?$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   139
			return $1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   140
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   141
		return '';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   142
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   143
	if ($Sect eq 'Ext') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   144
		if ($P=~/(\.[^\\\.]*)$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   145
			return $1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   146
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   147
		return '';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   148
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   149
	if ($Sect eq 'File') {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   150
		if ($P=~/([^\\]*)$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   151
			return $1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   152
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   153
		return '';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   154
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   155
	undef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   156
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   157
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   158
sub Path_Dirs ($) {	#args: $_[0] Abs FilePath/Path
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   159
# return an ordered list of individual directories that make up a path
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   160
	return undef unless $_[0]=~m-^\\-o;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   161
	my $P=&Path_Split('Path',$_[0]);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   162
	return undef unless $P=~s-^(.*)\\$-$1-o;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   163
	$P=~s-^\\(.*)-$1-o;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   164
	split /\\/,$P;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   165
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   166
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   167
sub Path_StepDirs ($) { #args: $_[0] Abs FilePath/Path
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   168
# return an ordered list of paths - starting with the directory in the root directory from the
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   169
# path passed into the function, each subsequent path contains the next directory from the path
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   170
# passed into the function, and the last path is the same as the path passed into the function
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   171
	return undef unless $_[0]=~m-^\\-o;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   172
	my $P=$_[0];
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   173
	my @Dirs=&Path_Dirs($P);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   174
	my @StepDirs;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   175
	my $dir;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   176
	my $stepDir="\\";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   177
	foreach $dir (@Dirs) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   178
		$stepDir.="$dir\\";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   179
		push @StepDirs, $stepDir;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   180
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   181
	@StepDirs;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   182
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   183
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   184
sub Path_Strip ($) {	#args: $_[0] Abs FilePath/Path
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   185
# Remove excess occurrences of '..' and '.' from a path
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   186
	return undef unless $_[0]=~m-^\\-o;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   187
	my $P=$_[0];
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   188
	while ($P=~s-\\\.\\-\\-go) { }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   189
	while ($P=~s-\\(?!\.{2}\\)[^\\]*\\\.{2}(?=\\)--go) { }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   190
	$P;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   191
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   192
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   193
sub Path_MakePathL (@) {	#args: @_ list of Abs FilePath/Path
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   194
# make a directory or list of directories
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   195
	my @Paths=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   196
	my $P;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   197
	foreach $P (@Paths) { 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   198
		return undef unless $P=~m-^\\-o;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   199
		$P=&Path_Split('Path',$P);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   200
		$P=&Path_Strip($P);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   201
		$P=~m-(.*)\\-o;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   202
		if (-d $1) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   203
			if ($Mode{'Verbose'}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   204
				print "Existing Path: \"$P\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   205
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   206
			next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   207
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   208
		mkpath[$P];
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   209
		if ($Mode{'Verbose'}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   210
			print "Created Path: \"$P\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   211
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   212
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   213
	return wantarray ? @Paths : $Paths[0];
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   214
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   215
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   216
sub Path_UpToRoot ($) {	#args: $_[0] Abs FilePath/Path
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   217
# return the path that will lead from the directory the path passed into the function
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   218
# specifies back up to the root directory
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   219
	return undef unless $_[0]=~m-^\\-o;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   220
	my $Path=$_[0];
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   221
	my $UpP;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   222
	while ($Path=~m-\\-go) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   223
		$UpP.="..\\";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   224
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   225
	undef $Path;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   226
	$UpP=~s-^(.*)\.\.\\-$1-o;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   227
	$UpP=".\\" unless $UpP;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   228
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   229
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   230
sub Path_MakeRlt ($@) {	#args: $_[0] Start UpPath $_[1]... list of (Abs FilePath/Path)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   231
# make a path, or list of paths, relative to a particular directory specified by the first
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   232
# path passed into the function which leads upwards from a particular directory
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   233
	return undef unless $_[0]=~m-(|\\$)-o;	# allow for null value passed in
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   234
	my ($UpPath,@List)=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   235
	my $p;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   236
	foreach $p (@List) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   237
		return undef unless $p=~m-^\\-o;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   238
		$p=~s-^\\(.*)$-$1-o;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   239
		$p=$UpPath.$p;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   240
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   241
	return wantarray ? @List : $List[0];	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   242
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   243
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   244
sub Path_MakeAbs ($@) {	#args: $_[0] Start Abs FilePath/Path $_[1]... list of (Abs/Rel FilePath/Path)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   245
# make a path, or list of paths, absolute given the directory specified by the first path
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   246
# passed into the function which the other paths passed into the function are assumed to be
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   247
# relative to
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   248
	return undef unless $_[0]=~m-^\\-o;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   249
	my ($Path,@List)=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   250
	my $BasePath=&Path_Split("Path",$Path);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   251
	undef $Path;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   252
	my $p;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   253
	foreach $p (@List) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   254
		if ($p=~m-^\.{2}-o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   255
			$p=&Path_Strip($BasePath.$p);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   256
			next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   257
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   258
		if ($p=~m-^[^\.\\]-o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   259
			$p=&Path_Strip($BasePath.$p);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   260
			next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   261
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   262
		if ($p=~m-^\\-o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   263
			$p=&Path_Strip($p);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   264
			next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   265
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   266
		if ($p=~m-^\.\\(.*)$-o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   267
			$p=&Path_Strip($BasePath.$1);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   268
			next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   269
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   270
		return undef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   271
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   272
	return wantarray ? @List : $List[0];
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   273
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   274
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   275
sub Path_MakeEAbs ($@) {	#args: $_[0] Start EPOCPath Abs FilePath/Path $_[1]... list of (Abs/Rel FilePath/Path)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   276
# Variant of MakAbs which also maps "+\\" to "${EPOCPath}"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   277
	return undef unless $_[0]=~m-^\\-o;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   278
	my ($EPOCPath,$Path,@List)=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   279
	my $BasePath=&Path_Split("Path",$Path);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   280
	undef $Path;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   281
	my $p;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   282
	foreach $p (@List) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   283
		if ($p=~m-^\\epoc32\\(.*)$-io) {	# change - special case for existing \\epoc32 references
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   284
			$p=$EPOCPath.$1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   285
			next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   286
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   287
		if ($p=~m-^\s*\+\\(.*)$-o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   288
			$p=$EPOCPath.$1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   289
			next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   290
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   291
		if ($p=~m-^\.{2}-o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   292
			$p=&Path_Strip($BasePath.$p);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   293
			next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   294
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   295
		if ($p=~m-^[^\.\\]-o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   296
			$p=$BasePath.$p;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   297
			next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   298
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   299
		if ($p=~m-^\\-o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   300
			next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   301
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   302
		if ($p=~m-^\.\\(.*)$-o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   303
			$p=&Path_Strip($BasePath.$1);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   304
			next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   305
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   306
		return undef;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   307
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   308
	return wantarray ? @List : $List[0];
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   309
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   310
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   311
sub Path_Chop (@) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   312
# remove the terminating backslash from a path, or list of paths, if there is one
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   313
	my @List=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   314
	my $Path;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   315
	foreach $Path (@List) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   316
		$Path=~s-^(.*)\\$-$1-o;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   317
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   318
	return wantarray ? @List : $List[0];
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   319
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   320
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   321
sub Path_Quote ($) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   322
# Quote name for use in GNU makefiles
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   323
	my @List=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   324
	my $Path;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   325
	foreach $Path (@List) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   326
		$Path=~s- -\\ -go if (defined($Path));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   327
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   328
	return wantarray ? @List : $List[0];
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   329
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   330
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   331
sub Path_Norm ($) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   332
# Normalise source specified paths for processing
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   333
	my ($Path) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   334
	$Path =~ s/\//\\/g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   335
	return $Path;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   336
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   337
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   338
sub Path_PrefixWithDrive ($) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   339
# Take a path, or list of paths, and prefix with drive based on CWD.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   340
# Relative paths are just returned.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   341
	my @List=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   342
	my $Path;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   343
	my $Drive=$1 if (cwd =~ /^(.:)/); 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   344
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   345
	foreach $Path (@List) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   346
		next if ($Path !~ /^\\/);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   347
		$Path=$Drive.$Path;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   348
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   349
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   350
	return wantarray ? @List : $List[0];
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   351
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   352
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   353
sub Path_PrefixWithDriveAndQuote ($) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   354
# Take a path, or list of paths, and prefix with drive based on CWD.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   355
# Relative paths are just quoted.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   356
	my @List=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   357
	my $Path;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   358
	my $Drive=$1 if (cwd =~ /^(.:)/); 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   359
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   360
	foreach $Path (@List) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   361
		next if ($Path !~ /^\\/);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   362
		$Path=$Drive.$Path;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   363
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   364
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   365
	foreach $Path (@List) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   366
		$Path="\"".$Path."\"";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   367
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   368
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   369
	return wantarray ? @List : $List[0];
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   370
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   371
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   372
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   373
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   374
BEGIN {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   375
# get the current working directory
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   376
	$WorkPath=cwd;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   377
	$WorkPath=~s-/-\\-go; # separator from Perl 5.005_02+ is forward slash
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   378
	$WorkPath=~s/^(.:)//o;    # remove drive letter
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   379
	$Drive=$1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   380
	$WorkPath=~s-^(.*[^\\])$-$1\\-o;        # ensure workpath ends with a backslash
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   381
	@WorkPathList=&Path_Dirs($WorkPath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   382
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   383
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   384
1;