1
0
forked from 0ad/0ad

Moved xmbcleanup so that non-programmers can reach it

This was SVN commit r1534.
This commit is contained in:
Ykkrosh 2004-12-19 00:42:44 +00:00
parent eb033b8192
commit 6885cb2d83
3 changed files with 14 additions and 5 deletions

View File

@ -1,4 +1,4 @@
@echo off @echo off
cd ..\..\build\xmbcleanup cd ..\system
set PATH=..\bin set PATH=.
xmbcleanup.exe xmbcleanup.exe %*

Binary file not shown.

View File

@ -3,6 +3,8 @@ use warnings;
use File::Find; use File::Find;
my $remove_all = (grep /removeall/, @ARGV);
++$|; ++$|;
# Relative to build/bin or build/xmbcleanup # Relative to build/bin or build/xmbcleanup
@ -34,9 +36,16 @@ for (@xmlfiles) {
# Find all such files # Find all such files
my @xmbfiles = glob $f; my @xmbfiles = glob $f;
next unless @xmbfiles;
# Remove them all, if asked to do so
if ($remove_all) {
print "DELETING @xmbfiles\n";
unlink @xmbfiles;
$count += @xmbfiles;
# If there are two or more, delete all but the newest # If there are two or more, delete all but the newest
if (@xmbfiles > 1) { } elsif (@xmbfiles > 1) {
@xmbfiles = sort @xmbfiles; # files are "etc_<TIMESTAMP><SIZE><VERSION>xmb", with TIMESTAMP @xmbfiles = sort @xmbfiles; # files are "etc_<TIMESTAMP><SIZE><VERSION>xmb", with TIMESTAMP
# hex-encoded, so sorting will put the oldest files first. # hex-encoded, so sorting will put the oldest files first.
# Remove the newest # Remove the newest
@ -49,4 +58,4 @@ for (@xmlfiles) {
} }
print "\n\nCompleted - $count ".($count==1?'file':'files')." deleted. Press enter to exit."; print "\n\nCompleted - $count ".($count==1?'file':'files')." deleted. Press enter to exit.";
<> <STDIN>;