3 #*************************************************************************
5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 # Copyright 2000, 2010 Oracle and/or its affiliates.
9 # OpenOffice.org - a multi-platform office productivity suite
11 # This file is part of OpenOffice.org.
13 # OpenOffice.org is free software: you can redistribute it and/or modify
14 # it under the terms of the GNU Lesser General Public License version 3
15 # only, as published by the Free Software Foundation.
17 # OpenOffice.org is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU Lesser General Public License version 3 for more details
21 # (a copy is included in the LICENSE file that accompanied this code).
23 # You should have received a copy of the GNU Lesser General Public License
24 # version 3 along with OpenOffice.org. If not, see
25 # <http://www.openoffice.org/license.html>
26 # for a copy of the LGPLv3 License.
28 #*************************************************************************
33 use English
; # $OSNAME, ...
38 our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
41 # if using RCS/CVS, this may be preferred
42 $VERSION = do { my @r = (q
$Revision: 1.1 $ =~ /\d+/g); sprintf "%d."."%02d" x
$#r, @r }; # must be all one line, for MakeMaker
44 @EXPORT = qw(&dospath &unixpath &appendPath &appendClass &setPrefix &getToolsPrefix &rmkdir &getJavaPathSeparator &getJavaFileDirSeparator &getFromPathes &convertCygwinPath);
45 %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
46 # your exported package globals go here,
47 # as well as any optionally exported functions
48 @EXPORT_OK = ( ); # qw($Var1 %Hashit &func3);
52 # ------------------------------------------------------------------------------
53 # helper, to change all file separators
57 if ($OSNAME eq "MSWin32")
59 # make out of '/' a '\'
71 if ($OSNAME ne "MSWin32")
73 # make out of '\' a '/'
82 # ------------------------------------------------------------------------------
83 # sub getGlobalInstSet()
86 # if ($OSNAME eq "MSWin32")
88 # # $sJumbo = "\\\\so-gfxcmp-lin\\jumbo_ship\\install";
89 # $sJumbo = "\\\\jumbo.germany.sun.com\\ship\\install";
91 # elsif ($OSNAME eq "cygwin")
93 # $sJumbo = "//jumbo.germany.sun.com/ship/install";
97 # $sJumbo = "/net/jumbo.germany.sun.com/ship/install";
102 # ------------------------------------------------------------------------------
103 # sub getSolarisLockFile()
105 # my $sSolarisLockFile = "/tmp/.ai.pkg.zone.lock-afdb66cf-1dd1-11b2-a049-000d560ddc3e";
106 # return $sSolarisLockFile;
109 # sub checkForSolarisLock()
111 # if ($OSNAME eq "solaris")
113 # # wait until the internal installer lock is gone
114 # while ( -e getSolarisLockFile() )
116 # while ( -e getSolarisLockFile() )
118 # log_print( "Warning: Wait active until installer lock is gone. \n");
123 # log_print( "[ok], lock is gone.\n");
127 # sub deleteSolarisLock()
129 # if ($OSNAME eq "solaris")
132 # unlink getSolarisLockFile();
135 # if ( -e getSolarisLockFile() )
137 # # try delete the file as super user?
138 # `sudo rm -f getSolarisLockFile()`;
144 # ------------------------------------------------------------------------------
148 my $sAddPath = shift;
149 if ($sPath && $sAddPath)
151 if (! endswith
($sPath, "/") &&
152 ! endswith
($sPath, "\\"))
154 # getJavaFileDirSeparator();
165 my $sAddPath = shift;
167 my $sSeparator = getJavaPathSeparator
();
168 if ($sPath && $sAddPath)
170 if (! endswith
($sPath, $sSeparator))
172 # getJavaFileDirSeparator();
173 $sPath .= $sSeparator;
180 # ------------------------------------------------------------------------------
193 # ------------------------------------------------------------------------------
196 # sub getProgramPrefix($)
198 # my $sDBDistinct = shift;
200 # my $sProgramPrefix;
201 # if (! $programprefix)
203 # if ($OSNAME eq "MSWin32")
205 # # $programprefix = "C:/gfxcmp/programs";
206 # $programprefix = "C:";
207 # if (getPrefix() eq "performance")
209 # $programprefix = "D:";
211 # $programprefix = appendPath($programprefix, "gp");
213 # elsif ($OSNAME eq "linux")
215 # $programprefix = "/space/" . getPrefix() . "/programs";
217 # elsif ($OSNAME eq "solaris")
219 # $programprefix = "/space/" . getPrefix() . "/programs";
223 # print "Error: This environment isn't supported yet.\n";
227 # $sProgramPrefix = appendPath($programprefix, substr($sDBDistinct, 0, 19));
228 # return $sProgramPrefix;
230 # ------------------------------------------------------------------------------
238 if ($OSNAME eq "MSWin32")
241 if (getPrefix
() eq "performance")
246 elsif ($OSNAME eq "linux")
248 $toolsprefix = "/space";
250 elsif ($OSNAME eq "solaris")
252 $toolsprefix = "/space";
256 print "Error: This environment isn't supported yet.\n";
259 $toolsprefix = appendPath
($toolsprefix, getPrefix
());
260 $toolsprefix = appendPath
($toolsprefix, "tools");
262 $sToolsPrefix = $toolsprefix;
263 return $sToolsPrefix;
273 my @dirs = split(/\//, $tpath);
276 @dirs = split("\\\\", $tpath);
281 $accum = "$accum$dir/";
293 # ------------------------------------------------------------------------------
294 sub getJavaPathSeparator
()
297 if ($OSNAME eq "MSWin32" || $OSNAME eq "cygwin")
303 # ------------------------------------------------------------------------------
304 sub getJavaFileDirSeparator
()
307 if ($OSNAME eq "MSWin32")
313 # ------------------------------------------------------------------------------
314 sub getFromPathes
($$)
316 my $sPathesIni = shift;
317 my $searchvalue = shift;
322 if (open(PATHES
, "$sPathesIni"))
325 while ($line = <PATHES
>)
328 if ($line =~ /^$searchvalue=(.*)$/)
339 sub convertCygwinPath
($)
343 if ($OSNAME eq "cygwin")
345 # print "Cygwin Path Patch.\n" if ($verbose);
346 if ($sPath =~ /\/cygdrive\
/(.)/)
349 $sPath =~ s/\/cygdrive\/${Letter
}/${Letter}\:/;
350 # print "Cygwin Path Patch: '$sPath'\n" if ($verbose);