Author: jwilcox
Date: 2007-10-05 18:13:14 -0400 (Fri, 05 Oct 2007)
New Revision: 87019

Modified:
   trunk/ipod-sharp/src/TrackDatabase.cs
Log:
fix a couple snags with missing directories and what not


Modified: trunk/ipod-sharp/src/TrackDatabase.cs
===================================================================
--- trunk/ipod-sharp/src/TrackDatabase.cs       2007-10-05 22:07:14 UTC (rev 
87018)
+++ trunk/ipod-sharp/src/TrackDatabase.cs       2007-10-05 22:13:14 UTC (rev 
87019)
@@ -1424,6 +1424,9 @@
         // are invalid.
         public void ReloadTrackIds()
         {
+            if (tracks.Count == 0)
+                return;
+            
             TrackRecord[] trks = new TrackRecord[tracks.Count];
             tracks.Values.CopyTo(trks, 0);
 
@@ -2504,6 +2507,11 @@
             if (SaveStarted != null)
                 SaveStarted(this, new EventArgs());
 
+            string trackDbDir = Path.GetDirectoryName (TrackDbPath);
+            if (!Directory.Exists (trackDbDir)) {
+                Directory.CreateDirectory (trackDbDir);
+            }
+
             // Back up the current track db
             if (File.Exists(TrackDbPath) && device.CanWrite)
                 File.Copy(TrackDbPath, TrackDbBackupPath, true);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to