Skip to content

Commit

Permalink
Merge pull request #1 from DomDom3333/Adding-Check-for-lastFilePlayed…
Browse files Browse the repository at this point in the history
…-before-Opening

Quick check if the path in the textbox is a valid file
  • Loading branch information
DomDom3333 authored Nov 13, 2020
2 parents 75be190 + de3f6d0 commit c840f2e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/view/Tui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace MusicSharp
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using Terminal.Gui;

/// <summary>
Expand Down Expand Up @@ -210,9 +211,16 @@ private void OpenFile()

if (!d.Canceled)
{
if (File.Exists(d.FilePath.ToString()))
{
this.player.LastFileOpened = d.FilePath.ToString();
this.player.OpenFile(this.player.LastFileOpened);
this.NowPlaying(this.player.LastFileOpened);
}
else
{
//This is a good spot for an error message, should one be wanted/needed
}
}
}

Expand Down

0 comments on commit c840f2e

Please sign in to comment.