Skip to content
This repository has been archived by the owner on Jul 29, 2023. It is now read-only.

Commit

Permalink
Bugfix: don't overwrite imported playlists (append number)
Browse files Browse the repository at this point in the history
  • Loading branch information
GeekJosh committed Jan 9, 2019
1 parent 9ef8f02 commit aebd22b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions BOXVR Playlist Manager/Playlist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,14 @@ public async static Task<Playlist> Import(string filename)
Title = Path.GetFileNameWithoutExtension(filename),
};

var _dupCount = 0;
var _title = playlist.Title;
while (File.Exists(Path.Combine(playlist.SavePath, playlist.Title + ".playlist.txt")))
{
_dupCount++;
playlist.Title = $"{_title} ({_dupCount})";
}

var reader = PlaylistReaderFactory.GetInstance().GetPlaylistReader(filename);
foreach (var track in reader.GetFiles())
playlist.Tracks.Add(new Track(track));
Expand Down

0 comments on commit aebd22b

Please sign in to comment.