Subversion Repositories DevTools

Rev

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

Rev 391 Rev 2438
Line 863... Line 863...
863
#                   Really delete it. Allow for users to remove directory
863
#                   Really delete it. Allow for users to remove directory
864
#                   without search permissions under unix.
864
#                   without search permissions under unix.
865
#
865
#
866
#                   Can also delete a file
866
#                   Can also delete a file
867
#
867
#
-
 
868
#                   This function has a bit of history
-
 
869
#                   I've tried the Perl rmtree(), but there were situations
-
 
870
#                   where the OS(WIN32) says the directory exists after its been
-
 
871
#                   deleted. Also the Jats-Win32 version of chmod would issue
-
 
872
#                   messages if it couldn't find the dir/file.
-
 
873
#
-
 
874
#                   The solution is to use JATS' own JatsFileUtil utility
-
 
875
#                   This appears to do the right thing
-
 
876
#
868
# Inputs          : $path                   - Path to directory
877
# Inputs          : $path                   - Path to directory
869
#
878
#
870
# Returns         : 1                       - Still there
879
# Returns         : 1                       - Still there
871
#
880
#
872
sub RmDirTree
881
sub RmDirTree
873
{
882
{
874
    my ($path) = @_;
883
    my ($path) = @_;
875
    rmtree( $path );
-
 
876
    if ( -e $path )
884
    if ( -e $path )
877
    {
885
    {
-
 
886
        #  Need to know if its a file or a directory
-
 
887
        #
-
 
888
        my $mode = ( -d $path ) ? 'T' : 'r';
-
 
889
 
-
 
890
        #
-
 
891
        #   Use JATS's own utility to do the hardwork
-
 
892
        #   Used as it address a number of issues
-
 
893
        #
-
 
894
        #   Merge in verbosity
-
 
895
        #
-
 
896
        system ("$ENV{GBE_BIN}/JatsFileUtil", $mode . $::ScmVerbose, '', $path );
-
 
897
 
-
 
898
        #
-
 
899
        #   Shouldn't happen but ...
-
 
900
        #   If the path still exists try another (one this has known problems)
-
 
901
        #
-
 
902
        if ( -e $path )
-
 
903
        {
878
        Verbose3 ("RmDirTree: Directory still exists. Change permissions: $path");
904
            Verbose3 ("RmDirTree: Directory still exists. Change permissions: $path");
879
        system ("$ENV{GBE_BIN}/chmod", '-R', 'u+wrx', $path);
905
            system ("$ENV{GBE_BIN}/chmod", '-R', 'u+wrx', $path);
880
        rmtree( $path );
906
            rmtree( $path );
-
 
907
        }
881
    }
908
    }
882
    return ( -e $path );
909
    return ( -e $path );
883
}
910
}
884
 
911
 
885
1;
912
1;