title: C# System.ArgumentException: "Empty path name is not legal."
body: <p>I'm messing about with winforms and zip programs. Now, the first hiccup I had was that it didn't force any extension when I tried to save it, so if I typed in a name it just saved it as a file. I fixed this with: (although, if I typed in name.rar it worked fine, but we want the .rar part to be automatic, of course)</p>
  
  <pre><code>saveFileDialog1.Title = "Izberi kam naj se datoteke kompresirajo";
  saveFileDialog1.DefaultExt = "rar";
  saveFileDialog1.Filter = "RAR Files (*.rar)|*.rar";
  saveFileDialog1.FilterIndex = 1;
  </code></pre>
  
  <p>Now it forces .rar as an extension, although, it's in the "Save as type" drop-down, not in the name itself. </p>
  
  <p>When I try to save it with just a name; it throws the "empty path name is not legal" error, it does the same thing if I input .rar at the end.</p>
  
  <p>Here's the rest of the code of the button; the others work fine. It happens at the <code>ZipArchive zip = ZipFile.Open</code> line.</p>
  
  <pre><code>private void button3_Click(object sender, EventArgs e)
  {
  
      saveFileDialog1.Title = "Izberi kam naj se datoteke kompresirajo";
      saveFileDialog1.DefaultExt = "rar";
      saveFileDialog1.Filter = "RAR Files (*.rar)|*.rar";
      saveFileDialog1.FilterIndex = 1;
  
  
      DialogResult result = saveFileDialog1.ShowDialog();
      if (result == DialogResult.OK)
      {
          if (isFolder)
          {
              ZipFile.CreateFromDirectory(textBox1.Text, saveFileDialog1.FileName);
          }
          else
          {
              string[] files = textBox1.Text.Split(',');
              ZipArchive zip = ZipFile.Open(saveFileDialog1.FileName, ZipArchiveMode.Create);
              foreach (string file in files)
              {
                  zip.CreateEntryFromFile(file, Path.GetFileName(file), CompressionLevel.Optimal);
              }
              zip.Dispose();
          }
          MessageBox.Show("Uspešno!");
      }
  }
  </code></pre>