Skip to content

Fixes an issue causing file tags list to be serialized wrong #7017

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Files/Controllers/TerminalController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,18 @@ public class TerminalController : IJson

public TerminalController()
{
Model = new TerminalFileModel();
}

public async Task InitializeAsync()
{
await LoadAsync();
await GetInstalledTerminalsAsync();
await StartWatchConfigChangeAsync();
CoreApplication.MainView.DispatcherQueue.TryEnqueue(() =>
{
ModelChanged?.Invoke(this);
});
}

private async Task LoadAsync()
Expand Down
2 changes: 1 addition & 1 deletion Files/DataModels/TerminalFileModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public Terminal GetDefaultTerminal()
ResetToDefaultTerminal();
}

return Terminals.First();
return Terminals.FirstOrDefault();
}

public void ResetToDefaultTerminal()
Expand Down
5 changes: 4 additions & 1 deletion Files/Helpers/NavigationHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@ public static async void LaunchNewWindow()
public static async Task OpenDirectoryInTerminal(string workingDir)
{
var terminal = App.TerminalController.Model.GetDefaultTerminal();
if (terminal == null)
{
return;
}

var connection = await AppServiceConnectionHelper.Instance;

if (connection != null)
{
var value = new ValueSet()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public DefaultJsonSettingsDatabase(IJsonSettingsSerializer jsonSettingsSerialize

protected virtual Dictionary<string, object> GetNewSettingsCache()
{
string settingsData = settingsSerializer.ReadFromFile();
string settingsData = settingsSerializer.ReadFromFile() ?? string.Empty;

return jsonSettingsSerializer.DeserializeFromJson<Dictionary<string, object>>(settingsData) ?? new Dictionary<string, object>();
}
Expand Down
1 change: 1 addition & 0 deletions Files/Properties/Default.rd.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

<Type Name="Files.Views.PaneNavigationArguments" Dynamic="Required All" />
<Type Name="Files.UserControls.MultitaskingControl.TabItemArguments" Dynamic="Required All" />
<Type Name="Files.Filesystem.FileTag" Dynamic="Required All" />

<!-- Add your application specific runtime directives here. -->
</Application>
Expand Down
2 changes: 1 addition & 1 deletion Files/Services/Implementation/FileTagsSettingsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public FileTag GetTagById(string uid)
{
if (FileTagList.Any(x => x.Uid == null))
{
// Tags file is invalid, regenerate
App.Logger.Warn("Tags file is invalid, regenerate");
FileTagList = s_defaultFileTags;
}
var tag = FileTagList.SingleOrDefault(x => x.Uid == uid);
Expand Down