You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gnucash/packaging/win32/gnc-path-check

72 lines
2.3 KiB

#!/bin/perl -w
######################################################################
### gnc-path-check - verify the windows path
###
### This script verifies the window path. It is used to check for an error
### condition identified in Bug 657117
### (https://bugzilla.gnome.org/show_bug.cgi?id=657117)
###
### Verifying that all directies in the path environment will avoid
### the glib bug conditioned identified bug 670233.
###
### Copyright © Dave Roberts 2012 (droberts@cpan.org)
###
### This program is free software; you can redistribute it and/or
### modify it under the terms of the GNU General Public License as
### published by the Free Software Foundation; either version 2 of
### the License, or (at your option) any later version.
###
### This program is distributed in the hope that it will be useful,
### but WITHOUT ANY WARRANTY; without even the implied warranty of
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
### GNU General Public License for more details.
###
### You should have received a copy of the GNU General Public License
### along with this program# if not, contact:
###
### Free Software Foundation Voice: +1-617-542-5942
### 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
### Boston, MA 02110-1301, USA gnu@gnu.org
######################################################################
use strict;
use English;
use Win32;
# Input: <none>
#
# Output:
#
# A list of directory names in the PATH that are not valid. The normal
# output (no error found) is nothing.
#
# Exit status
#
# 0 - success
# non-zero - failure - number of invalid directories found
my $path = Win32::ExpandEnvironmentStrings("%Path%");
my(@path) = split(/;/,$path);
my($error) = 0;
my($msg) = << "EOT";
The following directory name(s) were found in the PATH environment
which are invalid. This may cause the Finance Quote function to fail
depending on the order of directories in the PATH. Please correct the
system PATH variable.
EOT
foreach my $_ (@path){
my($dir) = Win32::ExpandEnvironmentStrings("$_");
unless (-d $dir){
$msg .= " $dir\n";
$error++;
}
}
if ($error){
print STDERR $msg;
}
exit $error;