Skip to content

Commit

Permalink
Merge pull request #714 from ionite34/backport/main/pr-712
Browse files Browse the repository at this point in the history
[dev to main] backport: Show warning if the user hasn't extracted the app … (712)
  • Loading branch information
mohnjiles authored Jun 28, 2024
2 parents ff631ee + 9af60b3 commit c8d21f9
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
9 changes: 9 additions & 0 deletions StabilityMatrix.Avalonia/Languages/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions StabilityMatrix.Avalonia/Languages/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1116,4 +1116,7 @@
<data name="Label_AppData" xml:space="preserve">
<value>App Data</value>
</data>
<data name="Warning_PleaseExtractFirst" xml:space="preserve">
<value>PLEASE EXTRACT THE APP FROM THE ZIP FILE BEFORE RUNNING STABILITY MATRIX</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public partial class SelectDataDirectoryViewModel : ContentDialogViewModelBase
private const string FatWarningText = "FAT32 / exFAT drives are not supported at this time";

[ObservableProperty]
[NotifyPropertyChangedFor(nameof(IsInTempFolder))]
private string dataDirectory = DefaultInstallLocation;

[ObservableProperty]
Expand All @@ -58,6 +59,14 @@ public partial class SelectDataDirectoryViewModel : ContentDialogViewModelBase
[ObservableProperty]
private bool showFatWarning;

public bool IsInTempFolder =>
Compat
.AppCurrentDir.ToString()
.StartsWith(
Path.GetTempPath().TrimEnd(Path.DirectorySeparatorChar),
StringComparison.OrdinalIgnoreCase
);

public RefreshBadgeViewModel ValidatorRefreshBadge { get; } =
new()
{
Expand Down Expand Up @@ -89,6 +98,9 @@ private async Task<bool> ValidateDataDirectory()

ShowFatWarning = IsDriveFat(DataDirectory);

if (IsInTempFolder)
return false;

// Doesn't exist, this is fine as a new install, hide badge
if (!Directory.Exists(DataDirectory))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@
IsVisible="{Binding ShowFatWarning}"
FontSize="14"
Margin="0,8,0,0" />

<TextBlock
Text="{x:Static lang:Resources.Warning_PleaseExtractFirst}"
TextWrapping="Wrap"
TextAlignment="Center"
Foreground="Red"
FontSize="28"
IsVisible="{Binding IsInTempFolder}"
Margin="0,8,0,0" />
</StackPanel>

<StackPanel Grid.Row="2" Orientation="Vertical">
Expand Down Expand Up @@ -112,7 +121,6 @@
Command="{Binding OnCloseButtonClick}"
FontSize="16"
HorizontalAlignment="Center"
IsEnabled="{Binding IsDirectoryValid}"
Padding="16,8" />
<Button
Content="{x:Static lang:Resources.Action_Continue}"
Expand Down

0 comments on commit c8d21f9

Please sign in to comment.