Skip to content

Commit

Permalink
Add option to disable deleting of song id folder.
Browse files Browse the repository at this point in the history
Bump version.
  • Loading branch information
halsafar committed Aug 19, 2018
1 parent 6a844b7 commit 870075f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
1 change: 1 addition & 0 deletions SongBrowserPlugin/DataAccess/SongBrowserSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public class SongBrowserSettings

public bool folderSupportEnabled = false;
public bool randomInstantQueue = false;
public bool deleteNumberedSongFolder = true;

[NonSerialized]
private static Logger Log = new Logger("SongBrowserSettings");
Expand Down
2 changes: 1 addition & 1 deletion SongBrowserPlugin/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public string Name

public string Version
{
get { return "v2.2.5"; }
get { return "v2.2.6"; }
}

public void OnApplicationStart()
Expand Down
21 changes: 12 additions & 9 deletions SongBrowserPlugin/UI/Browser/SongBrowserUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -579,16 +579,19 @@ public void HandleDeleteDialogPromptViewControllerDidFinish(SimpleDialogPromptVi
}

// check if this is in the BeatSaberDownloader format
String[] splitPath = songPath.Split('/');
if (splitPath.Length > 2)
{
String numberedDir = splitPath[splitPath.Length - 2];
Regex r = new Regex(@"^\d{1,}-\d{1,}");
if (r.Match(numberedDir).Success)
if (_model.Settings.deleteNumberedSongFolder)
{
String[] splitPath = songPath.Split('/');
if (splitPath.Length > 2)
{
DirectoryInfo songNumberedDirPath = Directory.GetParent(songPath);
_log.Debug("Deleting song numbered folder: {0}", songNumberedDirPath.FullName);
Directory.Delete(songNumberedDirPath.FullName, true);
String numberedDir = splitPath[splitPath.Length - 2];
Regex r = new Regex(@"^\d{1,}-\d{1,}");
if (r.Match(numberedDir).Success)
{
DirectoryInfo songNumberedDirPath = Directory.GetParent(songPath);
_log.Debug("Deleting song numbered folder: {0}", songNumberedDirPath.FullName);
Directory.Delete(songNumberedDirPath.FullName, true);
}
}
}
}
Expand Down

0 comments on commit 870075f

Please sign in to comment.