From 4d7d80d57979d135db6349ab25a144ec42d9d8fb Mon Sep 17 00:00:00 2001 From: Marco Gavelli Date: Thu, 19 Dec 2024 00:33:28 +0100 Subject: [PATCH] Set content root dir for HostBuilder --- src/Files.App/Helpers/Application/AppLifecycleHelper.cs | 1 + src/Files.App/ViewModels/MainPageViewModel.cs | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Files.App/Helpers/Application/AppLifecycleHelper.cs b/src/Files.App/Helpers/Application/AppLifecycleHelper.cs index 10cfdaf9fa15..c3af6e823151 100644 --- a/src/Files.App/Helpers/Application/AppLifecycleHelper.cs +++ b/src/Files.App/Helpers/Application/AppLifecycleHelper.cs @@ -133,6 +133,7 @@ public static void ConfigureSentry() public static IHost ConfigureHost() { var builder = Host.CreateDefaultBuilder() + .UseContentRoot(Package.Current.InstalledLocation.Path) .UseEnvironment(AppLifecycleHelper.AppEnvironment.ToString()) .ConfigureLogging(builder => builder .ClearProviders() diff --git a/src/Files.App/ViewModels/MainPageViewModel.cs b/src/Files.App/ViewModels/MainPageViewModel.cs index 3953ed7ce984..8a2ba9ce232e 100644 --- a/src/Files.App/ViewModels/MainPageViewModel.cs +++ b/src/Files.App/ViewModels/MainPageViewModel.cs @@ -154,9 +154,9 @@ public async Task OnNavigatedToAsync(NavigationEventArgs e) // add last session tabs to closed tabs stack if those tabs are not about to be opened if (!UserSettingsService.AppSettingsService.RestoreTabsOnStartup && !UserSettingsService.GeneralSettingsService.ContinueLastSessionOnStartUp && UserSettingsService.GeneralSettingsService.LastSessionTabList != null) { - var items = new TabBarItemParameter[UserSettingsService.GeneralSettingsService.LastSessionTabList.Count]; - for (int i = 0; i < items.Length; i++) - items[i] = TabBarItemParameter.Deserialize(UserSettingsService.GeneralSettingsService.LastSessionTabList[i]); + var items = UserSettingsService.GeneralSettingsService.LastSessionTabList + .Where(tab => !string.IsNullOrEmpty(tab)) + .Select(tab => TabBarItemParameter.Deserialize(tab)).ToArray(); BaseTabBar.PushRecentTab(items); }