If variable path is empty, and editor.Text is not empty, the SaveFileDialog should be displayed.
Now, why on earth is this damn thing failing???
I have tried this with many different variations of code with the same result: FAIL:
if(path.Length >= 1) // path contains a path. Save changes instead of creating NEW file.
{
   File.WriteAllText(path, content);
}
else
{
   // no path defined. Create new file and write to it.
   using(SaveFileDialog saver = new SaveFileDialog())
   {
      if(saver.ShowDialog() == DialogButtons.OK)
      {
         File.WriteAllText(saver.Filename, content);
      }
   }
}
At the top of code file I have:
path = String.Empty;
So why the heck it this failing every single time, even after trying all of the below variations?
if(path.Length > 1) // path contains a path. Save changes instead of creating NEW file.
{
   File.WriteAllText(path, content);
}
else
{
   // no path defined. Create new file and write to it.
   using(SaveFileDialog saver = new SaveFileDialog())
   {
      if(saver.ShowDialog() == DialogButtons.OK)
      {
         File.WriteAllText(saver.Filename, content);
      }
   }
}
and
if(String.IsNullOrEmpty(path)) // path contains a path. Save changes instead of creating NEW file.
{
   File.WriteAllText(path, content);
}
else
{
   // no path defined. Create new file and write to it.
   using(SaveFileDialog saver = new SaveFileDialog())
   {
      if(saver.ShowDialog() == DialogButtons.OK)
      {
         File.WriteAllText(saver.Filename, content);
      }
   }
}
and
if(String.IsNullOrWhiteSpace(path)) // path contains a path. Save changes instead of creating NEW file.
{
   File.WriteAllText(path, content);
}
else
{
   // no path defined. Create new file and write to it.
   using(SaveFileDialog saver = new SaveFileDialog())
   {
      if(saver.ShowDialog() == DialogButtons.OK)
      {
         File.WriteAllText(saver.Filename, content);
      }
   }
}
This is making me very angry. How could this fail?
Setting a break point reveals that path is definitely null/"".