Skip to content

Commit

Permalink
Merge pull request #40 from lacostej/ensure_dotuplift
Browse files Browse the repository at this point in the history
Settings: ensure .upfile exists before attempting to create sample
  • Loading branch information
lacostej authored Dec 14, 2017
2 parents 4bb4b8f + b5b26fe commit 192bf77
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Assets/Plugins/Editor/Uplift/Windows/SettingsWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ protected void OnGUI()
#endif
scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);

if (!File.Exists(UpliftSettings.GetDefaultLocation()))
string settingsLocation = UpliftSettings.GetDefaultLocation();

FileSystemUtil.EnsureParentExists(settingsLocation);

if (!File.Exists(settingsLocation))
{
EditorGUILayout.HelpBox("It seems that you do not have a settings.xml file under HOME/.uplift.", MessageType.Warning);
if(GUILayout.Button("Create a sample settings file"))
Expand All @@ -55,15 +59,15 @@ protected void OnGUI()
else
{
if (settingsText == null)
settingsText = System.IO.File.ReadAllText(UpliftSettings.GetDefaultLocation());
settingsText = System.IO.File.ReadAllText(settingsLocation);

settingsText = EditorGUILayout.TextArea(settingsText);

if (GUILayout.Button("Save settings file"))
{
XmlDocument doc = new XmlDocument();
doc.InnerXml = settingsText;
doc.Save(UpliftSettings.GetDefaultLocation());
doc.Save(settingsLocation);
Repaint();
}
}
Expand Down

0 comments on commit 192bf77

Please sign in to comment.