From 6a23435dc6c1262ddcd2e3c0e6f74a931c4bd35a Mon Sep 17 00:00:00 2001
From: Bernie Innocenti <bernie@codewiz.org>
Date: Wed, 21 Apr 2010 14:36:38 -0400
Subject: [PATCH] Cleanup temporary files on startup (v2)
Organization: Sugar Labs Foundation
X-Subversion: sucks

This fixes part of http://bugs.sugarlabs.org/ticket/1876 , which is
affecting both 0.84 and 0.88.

To reclaim space in case of a crash, we also need to delete temporary
files at startup time. The rest of the bug is addressed by a separate
patch in sugar-toolkit.

This version of the patch takes into account the current SUGAR_PROFILE
and addresses the request to remove the temporary files before invoking
cleanup_logs().

Signed-off-by: Bernie Innocenti <bernie@codewiz.org>
Reviewed-by: James Cameron <quozl@laptop.org>
---
 bin/sugar.in |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/bin/sugar.in b/bin/sugar.in
index 898bd59..0c5baee 100644
--- a/bin/sugar.in
+++ b/bin/sugar.in
@@ -65,4 +65,7 @@ fi
 echo Xcursor.theme: sugar | xrdb -merge
 metacity --no-force-fullscreen -d $DISPLAY &
 
+# Remove temporary files. See http://bugs.sugarlabs.org/ticket/1876
+rm -rf $HOME/.sugar/${SUGAR_PROFILE:-default}/data/*
+
 exec sugar-session
-- 
1.7.0.1

