diff options
| author | JP Dillingham <jp@dillingham.me> | 2022-10-01 14:58:04 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2022-10-01 14:58:04 -0500 |
| commit | efb613beb826bd27b8296c75d61993bdbdcc0bb5 (patch) | |
| tree | e841253521a82a50b009b6819c1990bb4543dc47 /src/slskd/Application.cs | |
| parent | 09ba5e716c3431cf4db1a8eea954ca420f3f05d7 (diff) | |
| download | slskd-efb613beb826bd27b8296c75d61993bdbdcc0bb5.tar.gz | |
move init to ShareService
Diffstat (limited to 'src/slskd/Application.cs')
| -rw-r--r-- | src/slskd/Application.cs | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs index 7e9ad4fd..da0688dd 100644 --- a/src/slskd/Application.cs +++ b/src/slskd/Application.cs @@ -371,22 +371,11 @@ namespace slskd _ = CheckVersionAsync(); } - // try to load the share cache from disk. - // if not successful, the file is missing one or more tables, or is not present at all - if (!Shares.TryLoadFromDisk()) + // initialize shares. most of the time shares will be loaded from disk, but + // if this is the first run or the user deleted cached files, a full scan will be performed + if (!OptionsAtStartup.Flags.NoShareScan) { - Log.Warning("Unable to load share cache from disk. A share scan is required."); - - State.SetValue(state => state with { Shares = state.Shares with { ScanPending = true } }); - - if (OptionsAtStartup.Flags.NoShareScan) - { - Log.Warning("Not scanning shares; 'no-share-scan' option is enabled. Search and browse results will remain disabled until a manual scan is completed."); - } - else - { - await Shares.ScanAsync(); - } + await Shares.InitializeAsync(); } if (OptionsAtStartup.Flags.NoConnect) |
