[72305] users/ryandesign/PCLauncher/PCLauncher.applescript

ryandesign at macports.org ryandesign at macports.org
Sun Oct 10 05:49:39 PDT 2010


Revision: 72305
          http://trac.macports.org/changeset/72305
Author:   ryandesign at macports.org
Date:     2010-10-10 05:49:36 -0700 (Sun, 10 Oct 2010)
Log Message:
-----------
AppleScriptify deleting old logs; fix deletion of files whose names contain spaces

Modified Paths:
--------------
    users/ryandesign/PCLauncher/PCLauncher.applescript

Modified: users/ryandesign/PCLauncher/PCLauncher.applescript
===================================================================
--- users/ryandesign/PCLauncher/PCLauncher.applescript	2010-10-10 12:38:33 UTC (rev 72304)
+++ users/ryandesign/PCLauncher/PCLauncher.applescript	2010-10-10 12:49:36 UTC (rev 72305)
@@ -262,8 +262,12 @@
 	end tell
 	
 	set gPid to (do shell script "(cd " & quoted form of gDataDirectory & " && " & quoted form of gPlasmaClientForGame & " " & quoted form of theUsername & " " & quoted form of thePassword & ") >& " & quoted form of gLogFile & " & echo $!")
-	do shell script "cd " & quoted form of gLogDirectory & " && ls PlasmaClient.*.log 2>/dev/null | sort -n -r | sed '1," & (kKeepLogs - 1) & "d' | xargs rm -f"
 	
+	set theLogFiles to listDirectory(gLogDirectory, "PlasmaClient.*.log")
+	repeat with i from 1 to (count theLogFiles) - kKeepLogs
+		deleteFile(item i of theLogFiles)
+	end repeat
+	
 	quit
 end startGame
 
@@ -283,6 +287,10 @@
 	do shell script "rm -rf " & quoted form of theDirectory
 end deleteDirectory
 
+on listDirectory(theDirectory, theGlob)
+	return paragraphs of (do shell script "ls " & quoted form of theDirectory & "/" & theGlob)
+end listDirectory
+
 on itemExists(theItem)
 	try
 		do shell script "test -e " & quoted form of theItem
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20101010/dc66ed55/attachment-0001.html>


More information about the macports-changes mailing list