1Shin on Discord (#feedback, 11-02): an export (Settings' backup, a
request saved from the archive, a session as Markdown, the usage file)
joined $HOME/Downloads, which is wrong when Downloads was moved: Windows'
known folder (to another drive or OneDrive) or the XDG one on Linux
(~/下载 on a Chinese desktop).
appdir.UserFolder(kind) asks the system: SHGetKnownFolderPath
(FOLDERID_Downloads/Desktop/Documents, KF_FLAG_DONT_VERIFY) on Windows,
used when magpie's home is the profile Windows keeps it for (a home given
of its own, as a test's, keeps home\Downloads); $XDG_CONFIG_HOME/
user-dirs.dirs on Linux and the BSDs, read as xdg-user-dir does ("$HOME/x"
or "/x", quoted, backslash escapes, the last line wins); ~/Downloads on a
Mac. A failed lookup is home/kind, as before. gui's downloads() tries it,
then home/Downloads, then home. appdir's sharedFolder (a data folder
beside magpie there isn't portable data) adds the system's folders to
home's, and Cursor's AppImage is looked for in the system's Downloads too.
update's isDownloadFolder already asked Windows for its known folders and
is unchanged.
Run at this head (rebased on origin/main):
- mote (macOS): gofmt -l clean; go vet ./internal/appdir ./internal/gui
./internal/agent; GOOS=windows go vet of those and ./internal/update;
GOOS=linux go vet -tags nogui of the three; go test ./internal/appdir ok,
-run "Backup|Export|Archive" ./internal/gui ok, -run
"Cursor|Desktop|Sandbox" ./internal/agent ok.
- wsl-run (Ubuntu 24.04): appdir's UserFolder/SharedFolder/ResolveDownloads
tests and gui's TestExportGoesToTheSystemsDownloads,
TestBackupLibraryRoundTrip and the session exports pass. Against the real
xdg-user-dir in a sandbox HOME, "$HOME/下载", "/mnt/d/My Downloads" and
"$HOME/a \"b\"" read the same; "$HOME/" gives home without the trailing
slash.
- win-run (Windows 11): the appdir tests pass, and
TestKnownFolderIsExplorers checks the known folder against Explorer's
User Shell Folders value (read only). Windows expands that value's
%USERPROFILE% once a process, with the first call's environment, so the
check runs in a child of its own. The real profile gives
C:\Users\yeton\Downloads, Desktop and Documents.
Broken by hand: no user-dirs.dirs read, or no profile check on Windows:
TestUserFolderXDG, XDGLines, XDGConfigHome and TestUserFolderWindows go
red. gui's downloads() without the system's folder:
TestExportGoesToTheSystemsDownloads red in WSL (saved in ~/Downloads, want
~/下载).
Not tried: a Downloads really redirected on Windows (to D:\ or OneDrive).
Moving it means writing the user's own User Shell Folders on the test box,
so the redirect is a faked known folder in TestUserFolderWindows only. Not
run: the GUI suite (no GUI file changed) and a full go test ./....