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

ryandesign at macports.org ryandesign at macports.org
Sun Oct 10 04:29:09 PDT 2010


Revision: 72302
          http://trac.macports.org/changeset/72302
Author:   ryandesign at macports.org
Date:     2010-10-10 04:29:06 -0700 (Sun, 10 Oct 2010)
Log Message:
-----------
Write log file and make link to it

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

Modified: users/ryandesign/PCLauncher/PCLauncher.applescript
===================================================================
--- users/ryandesign/PCLauncher/PCLauncher.applescript	2010-10-10 10:41:01 UTC (rev 72301)
+++ users/ryandesign/PCLauncher/PCLauncher.applescript	2010-10-10 11:29:06 UTC (rev 72302)
@@ -13,10 +13,15 @@
 property gPlasmaClient : gPrefix & "/bin/PlasmaClient"
 property gPlasmaClientForAuth : gPlasmaClient
 property gPlasmaClientForGame : gPlasmaClient
+
 property gDataDirectory : gPrefix & "/share/mystonline/data"
 property gPythonDirectory : gDataDirectory & "/python"
 property gSdlDirectory : gDataDirectory & "/SDL"
 
+property gLogDirectory : gPrefix & "/var/log/PlasmaClient"
+property gLogFile : ""
+property gLogLink : gLogDirectory & "/PlasmaClient.log"
+
 -- Task enums
 property kTaskIdle : 0
 property kTaskWaitForAuthentication : 1
@@ -35,6 +40,7 @@
 on will finish launching theObject
 	make new default entry at end of default entries of user defaults with properties {name:"username", contents:""}
 	make new default entry at end of default entries of user defaults with properties {name:"password", contents:""}
+	set gLogFile to gLogDirectory & "/PlasmaClient." & timeSinceEpoch() & ".log"
 end will finish launching
 
 on should quit after last window closed theObject
@@ -115,8 +121,12 @@
 		set thePassword to contents of text field "Password Field"
 	end tell
 	
+	if itemExists(gLogLink) then
+		deleteFile(gLogLink)
+	end if
+	makeLink(gLogFile, gLogLink)
 	set gStatusFile to makeTempFile()
-	set gPid to (do shell script "(" & quoted form of gPlasmaClientForAuth & " " & quoted form of theUsername & " " & quoted form of thePassword & " -t >& /dev/null; echo $?) >& " & quoted form of gStatusFile & " & echo $!")
+	set gPid to (do shell script "(" & quoted form of gPlasmaClientForAuth & " " & quoted form of theUsername & " " & quoted form of thePassword & " -t >& " & quoted form of gLogFile & "; echo $?) >& " & quoted form of gStatusFile & " & echo $!")
 	set gTask to kTaskWaitForAuthentication
 end startAuthentication
 
@@ -234,7 +244,7 @@
 		set thePassword to contents of text field "Password Field"
 	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 & ") &>/dev/null & echo $!")
+	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 $!")
 	
 	quit
 end startGame
@@ -271,6 +281,14 @@
 	do shell script "mv " & quoted form of fromItem & " " & quoted form of toItem
 end moveItem
 
+on makeLink(fromItem, toItem)
+	do shell script "ln -s " & quoted form of fromItem & " " & quoted form of toItem
+end makeLink
+
+on timeSinceEpoch()
+	return (do shell script "date '+%s'")
+end timeSinceEpoch
+
 on showProgressPanel(theMessage)
 	set gProgressMax to 0
 	tell window "Progress Panel"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20101010/55e54745/attachment-0001.html>


More information about the macports-changes mailing list