From d86255de5846db95fe25334acb5e882bb5d31dc5 Mon Sep 17 00:00:00 2001 From: FiftyShadesOfBlue Date: Fri, 16 Mar 2018 02:37:48 -0400 Subject: [PATCH] Added Try/Catch to prevent crashing if "Favorites.xml" cant be found --- Explorer/ExploreForm.cs | 4 ++-- Explorer/OrganizeFavorites.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Explorer/ExploreForm.cs b/Explorer/ExploreForm.cs index 68af1ca..37d200e 100644 --- a/Explorer/ExploreForm.cs +++ b/Explorer/ExploreForm.cs @@ -3338,11 +3338,11 @@ namespace CodeWalker if (LocationTextBox.Text != "") { XmlDocument xDoc = new XmlDocument(); - xDoc.Load(@"C:\Users\Skyler\Documents\GitHub\CodeWalker\Resources\Favorites.xml"); + xDoc.Load(Application.StartupPath + @"Resources\Favorites.xml"); XmlNode FavToAdd = xDoc.CreateElement("Favorite"); FavToAdd.InnerText = LocationTextBox.Text; xDoc.DocumentElement.AppendChild(FavToAdd); - xDoc.Save(@"C:\Users\Skyler\Documents\GitHub\CodeWalker\Resources\Favorites.xml"); + xDoc.Save(Application.StartupPath + @"Resources\Favorites.xml"); LoadFavorites(); } else diff --git a/Explorer/OrganizeFavorites.cs b/Explorer/OrganizeFavorites.cs index eeb6fe2..8563eb7 100644 --- a/Explorer/OrganizeFavorites.cs +++ b/Explorer/OrganizeFavorites.cs @@ -28,7 +28,7 @@ namespace CodeWalker.Explorer private void Init() { - xDoc.Load(@"C:\Users\Skyler\Documents\GitHub\CodeWalker\Resources\Favorites.xml"); + xDoc.Load(Application.StartupPath + @"Resources\Favorites.xml"); FavoriteNodes = xDoc.DocumentElement.SelectNodes("Favorite"); Root = xDoc.DocumentElement; foreach (XmlNode FavNode in FavoriteNodes)