Skip to content
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
4 changes: 3 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ syncing through the user's own Firestore. English and Rioplatense Spanish. GPL-3
$env:DOTNET_ROOT = "$env:LOCALAPPDATA\Microsoft\dotnet" # if the SDK isn't on PATH
dotnet test --project Queueify.Tests # unit tests, the TDD loop
tools\firestore-emulator.ps1 -Background; $env:QUEUEIFY_FIRESTORE_EMULATOR = '127.0.0.1:8080'
tools\package.ps1 # dist\Queueify\Queueify.exe + versioned copy
tools\package.ps1 # dist\Queueify\Queueify.exe + versioned copy (AOT, ~5 min)
powershell -ExecutionPolicy Bypass -File tests\ui\Queueify.UiTests.ps1 -Exe dist\Queueify\Queueify.exe
tools\release.ps1 -Preview # next changelog
```
Expand All @@ -38,5 +38,7 @@ tools\release.ps1 -Preview # next changelog

- The dev PC runs Windows 11 IoT Enterprise LTSC (no winget, no Microsoft Store). Git and the GitHub CLI
are portable installs in `%LOCALAPPDATA%\Programs`.
- Native AOT needs the C++ build tools (installed: VS 2022 Build Tools, VCTools workload); package.ps1
puts vswhere on PATH for it.
- Windows PowerShell 5.1 reads `.ps1` files as ANSI unless they have a UTF-8 BOM: save scripts with
non-ASCII text with a BOM.
6 changes: 4 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Thanks for helping. Queueify aims for a small, correct and boring codebase. Read

- Windows 10 2004+ or Windows 11, x64
- [.NET 10 SDK](https://dotnet.microsoft.com/download) (`global.json` pins the feature band)
- For `tools\package.ps1`: Visual Studio's C++ build tools (the *Desktop development with C++* workload, or
Build Tools with `Microsoft.VisualStudio.Workload.VCTools`): the app is compiled ahead of time to native code
- Git, with the repository's hooks: `git config core.hooksPath .githooks`
- Optional, for the sync tests: Java 21+ (the Firestore emulator jar is downloaded on first use)

Expand All @@ -16,15 +18,15 @@ Thanks for helping. Queueify aims for a small, correct and boring codebase. Read
| --- | --- |
| `dotnet test --project Queueify.Tests` | Unit tests (the TDD loop) |
| `tools\firestore-emulator.ps1 -Background` then `$env:QUEUEIFY_FIRESTORE_EMULATOR = '127.0.0.1:8080'` | Runs the sync tests too instead of skipping them |
| `tools\package.ps1` | Builds the portable app: one trimmed `dist\Queueify\Queueify.exe`, plus a versioned copy for the release |
| `tools\package.ps1` | Builds the portable app (about 5 minutes): one `dist\Queueify\Queueify.exe`, the starter with the app appended, plus a versioned copy for the release |
| `tests\ui\Queueify.UiTests.ps1 -Exe dist\Queueify\Queueify.exe` | UI tests through Windows UI Automation |
| `tests\ui\Queueify.SyncUiTests.ps1 -Exe dist\Queueify\Queueify.exe` | Sync UI test (needs the emulator) |
| `tests\tools\Release.Tests.ps1` | Tests for the release tool |
| `tools\release.ps1 -Preview` | What the next release's changelog will say |

Run the PowerShell scripts with `powershell -ExecutionPolicy Bypass -File <script>` if your execution
policy blocks them. The UI tests move the `Data` folder next to the exe aside and put it back afterwards,
so they never touch your real queue. Details: [docs/TESTING.md](docs/TESTING.md).
and give the app a scratch `%LOCALAPPDATA%`, so they never touch your real queue. Details: [docs/TESTING.md](docs/TESTING.md).

## Workflow

Expand Down
36 changes: 32 additions & 4 deletions Queueify.Core/Services/AppData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Queueify.Services;
public static class AppData
{
public static string Folder { get; } = FolderFor(
Environment.ProcessPath,
Started.Exe ?? Environment.ProcessPath,
LocalAppDataRoot(Environment.GetEnvironmentVariable("LOCALAPPDATA"), Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)),
EntriesOf);

Expand All @@ -26,6 +26,34 @@ public static class AppData
}
}

/// <summary>The download's starter this copy was started by, or null when it was started directly.</summary>
public static string? StarterExe => Started.Exe;

// Its own class, so it's set on first use whatever the order of AppData's other statics.
private static class Started
{
public static readonly string? Exe = Take();

private static string? Take()
{
var starter = Environment.GetEnvironmentVariable("QUEUEIFY_EXE");
// Read once and cleared: programs Queueify opens (a browser, say) must not inherit it.
Environment.SetEnvironmentVariable("QUEUEIFY_EXE", null);
var exe = StartedExe(starter, null, File.Exists);
return exe;
}
}

/// <summary>
/// The exe the user opened: the download's starter (QUEUEIFY_EXE, set when it runs the app from its
/// unpacked copy) when there is one and it exists, so a Data folder next to it still makes the app portable.
/// </summary>
public static string? StartedExe(string? starter, string? processPath, Func<string, bool> fileExists) =>
starter is { Length: > 0 } s && s.IndexOfAny(NeverInAPath) < 0 && Path.IsPathFullyQualified(s) && fileExists(s) ? s : processPath;

/// <summary>What a taskbar pin runs: the exe the user opened, quoted (its path may have spaces).</summary>
public static string RelaunchCommand(string startedExe) => $"\"{startedExe}\"";

/// <summary>
/// The LOCALAPPDATA variable when it's a full path (package.ps1's smoke test points it at a scratch
/// folder), otherwise Windows' known folder: a relative or quoted value would scatter the data.
Expand All @@ -44,9 +72,9 @@ public static string LocalAppDataRoot(string? variable, string knownFolder) =>
/// <summary>
/// A "Data" folder next to the exe the user started is used when it's Queueify's (it holds Queueify's
/// files, or is empty to start a portable copy); someone's own Documents\Data is left alone. Next to
/// the exe, not <see cref="AppContext.BaseDirectory"/>: the single-file app runs from a copy unpacked
/// into a temporary folder. <paramref name="dataFolderEntries"/> lists a folder's entries, or null
/// when it isn't a folder.
/// the exe the user opened, not <see cref="AppContext.BaseDirectory"/>: the download's starter runs the
/// app from a copy unpacked into %LOCALAPPDATA%\Queueify\app. <paramref name="dataFolderEntries"/> lists
/// a folder's entries, or null when it isn't a folder.
/// </summary>
public static string FolderFor(string? exePath, string localAppData, Func<string, string[]?> dataFolderEntries) =>
Path.GetDirectoryName(exePath) is { Length: > 0 } dir
Expand Down
6 changes: 5 additions & 1 deletion Queueify.Core/Services/Countries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

namespace Queueify.Services;

public sealed record CountryOption(string Code, string Name);
public sealed record CountryOption(string Code, string Name)
{
/// <summary>What screen readers say for the item in the Settings list.</summary>
public override string ToString() => Name;
}

/// <summary>
/// The countries offered in Settings: where Tidal is available, all of which are Spotify markets
Expand Down
6 changes: 5 additions & 1 deletion Queueify.Core/Services/OcrLanguages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

namespace Queueify.Services;

public sealed record OcrLanguageOption(string Tag, string Name);
public sealed record OcrLanguageOption(string Tag, string Name)
{
/// <summary>What screen readers say for the item in the Settings lists.</summary>
public override string ToString() => Name;
}

/// <summary>
/// The text recognition languages Queueify offers to install (Windows "Features on Demand"), and
Expand Down
Loading
Loading