Updated Main

Added Path checking for validating a path to use.
This commit is contained in:
Mario Steele 2025-07-23 22:30:58 -05:00
parent 595c93f50e
commit 5675ea116d

View file

@ -21,7 +21,21 @@ class Program
public static void Main(string[] args)
{
GlobalJsonOptions.Options.Converters.Add(new StringToLongJsonConverter(false));
var path = "/home/eumario/.var/app/io.freetubeapp.FreeTube/config/FreeTube/";
var paths = new string[]
{
Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".config/FreeTube/"),
Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
".var/app/io.freetubeapp.FreeTube/config/FreeTube")
};
var path = "";
foreach (var tpath in paths)
{
if (!Directory.Exists(tpath)) continue;
path = tpath;
break;
}
var dbWatcher = new DBSyncWatcher(path);
var historySyncer = new Syncer<History>(dbWatcher, Path.Join(path, "history.db"), "history.db", "/history");
var playlistSyncer = new Syncer<Playlist>(dbWatcher, Path.Join(path, "playlists.db"), "playlists.db", "/playlist");