Nota — a free DAW for macOS, Windows and Linux. No subscription, no account — just open it and make music.
Bug Assessment: OS Documents/Music locations ignored for default folders
- Slug: os-folders-defaults
- Created: 2026-11-05
- Source: https://github.com/nota-daw/nota/issues/522 (host: github.com, allowlisted; fetch permitted without prompting)
- Verdict: valid
- Severity: medium (wrong default browser/save locations on relocated/translated Documents/Music; creates unwanted
~/Documents; no data loss or crash, but affects every Linux user with custom XDG user-dirs and Windows users with redirected Known Folders)
Report (verbatim or summarized)
Respect OS Documents/Music locations for default Projects/Samples folders — Nota hardcodes
~/Documents/Nota Projects(SettingsService.ResolvedProjectsFolder) and~/Music/Nota Samples, ignoring XDG user-dirs on Linux and Known Folders on Windows. With relocated/translated Documents this creates an unwanted~/Documents.Expected: resolve via
XDG_DOCUMENTS_DIR/XDG_MUSIC_DIRon Linux,MyDocuments/MyMusicon Windows/macOS, with~/Documentsfallback; existingsettings.jsonoverride always wins.
Source URL: https://github.com/nota-daw/nota/issues/522
Symptom
On Linux with a relocated or translated Documents folder (e.g. ~/Dokumenty), and on Windows with redirected Documents/Music (OneDrive, custom location), Nota still browses/suggests ~/Documents/Nota Projects and ~/Music/Nota Samples, creating the hardcoded directory. Expected: defaults follow the OS locations; an explicit settings.json ProjectsFolder/SamplesFolder always wins.
Reproduction
- On Linux, set
XDG_DOCUMENTS_DIR="$HOME/Dokumenty"in~/.config/user-dirs.dirs(or use a system with translated user dirs). - Ensure
settings.jsonhas emptyProjectsFolder/SamplesFolder(defaults). - Start Nota, open browser Files/Projects tab or Save dialog (
MainWindow.Files.cs). - Observed: root/suggested location is
~/Documents/Nota Projects, and~/Documentsgets created. Expected:~/Dokumenty/Nota Projects.
[NEEDS CLARIFICATION: exact behavior when XDG_*_DIR is disabled ("$HOME") — fallback should be $HOME/Nota Projects, not recreating Documents. To confirm with reporter/maintainer.]
Suspected Code Paths
src/managed/Nota.Infrastructure/Settings/SettingsService.cs:45-51—ResolvedSamplesFolder()/ResolvedProjectsFolder()doPath.Combine(Home, "Music", "Nota Samples")andPath.Combine(Home, "Documents", "Nota Projects")when the setting is empty, thenEnsureDir(). This is the root.src/managed/Nota.Infrastructure/NotaPaths.cs:21—Home => Environment.GetFolderPath(UserProfile)(~); no XDG user-dirs or Known-Folder lookup anywhere.src/managed/Nota.Application/Settings.cs:37-40—SamplesFolder/ProjectsFolderempty-means-default contract; unchanged by fix.- Callers that inherit the bug (no change needed, they use the resolvers):
src/managed/Nota.Presentation/ViewModels/BrowserViewModel.cs:633,704,906,src/managed/Nota.App/MainWindow.Files.cs:37,231,387,src/managed/Nota.App/PreferencesWindow.cs:946,949,src/managed/Nota.Infrastructure/Mosaic/MosaicLibrary.cs:32,162,src/managed/Nota.Infrastructure/SampleStore/SampleStore.cs:38.
Grep confirms no existing XDG_DOCUMENTS, user-dirs.dirs, xdg-user-dir, or SpecialFolder.MyDocuments/MyMusic handling for these defaults.
Root Cause Hypothesis
Defaults are hardcoded to English ~/Documents / ~/Music instead of resolving the OS user folders. Confidence: high — directly visible in SettingsService.cs:45-51; Linux XDG user-dirs and Windows Known Folders are never consulted. .NET Environment.SpecialFolder.MyDocuments alone is not sufficient as the fix without verification on Linux, hence an explicit user-dirs.dirs parser is proposed.
Proposed Remediation
Preferred: add a small testable resolver in Nota.Infrastructure (next to NotaPaths), used by both Resolved*Folder() methods:
- Linux: parse
$XDG_CONFIG_HOME/user-dirs.dirs, fallback~/.config/user-dirs.dirs; keysXDG_DOCUMENTS_DIR/XDG_MUSIC_DIR; handle quotes,$HOME/..., absolute paths, missing file, and disabled ("$HOME"→$HOME/<fallback-name>); final fallback~/Documents/~/Music. No shell-out toxdg-user-dir(deterministic, testable, no process spawn on UI path). - Windows/macOS:
Environment.SpecialFolder.MyDocuments/MyMusic(respects redirection/OneDrive), fallback toHome/Documents/Home/Musicwhen empty. - Keep contract: non-empty
settings.jsonvalue always wins; keepEnsureDir()best-effort creation; no migration of existing~/Documents/Nota Projects. - Shape: e.g.
UserDirs.GetDocumentsDir(Home)/GetMusicDir(Home)with injectable env/file readers for tests;SettingsServiceappendsNota Projects/Nota Samples.
Alternatives:
- Use only
Environment.SpecialFolder.MyDocuments/MyMusiceverywhere: smaller, but relies on undocumented .NET-on-Linux XDG mapping; less deterministic for tests. - Shell out to
xdg-user-dir DOCUMENTS/MUSIC: reuses freedesktop logic, but adds process dependency and failure modes on startup/UI path.
Files likely to change:
src/managed/Nota.Infrastructure/Settings/SettingsService.cssrc/managed/Nota.Infrastructure/NotaPaths.cs(or newUserDirs.csnext to it)tests/Nota.SmokeTest/*(new resolver tests; existingSampleStoreTests.cs:178-179fakes remain valid)
Tests to add or update:
- Parser: quoted values,
$HOMEexpansion, absolute path, missing file, disabled ($HOME),XDG_CONFIG_HOMEoverride. - Resolver: Linux XDG hit, fallback to
~/Documents/~/Music; WindowsMyDocumentspath when available. - Existing smoke test must stay green (
scripts/build-linux.sh/scripts/build.sh).
Risks & Considerations
- Creating directories stays best-effort; permission failures must remain swallowed (existing behavior).
- Disabled Documents (
XDG_DOCUMENTS_DIR="$HOME") must not recreate~/Documents— use$HOME/Nota Projects. - Localized names with spaces/Unicode must survive parsing and
Path.Combine. - No audio-thread impact (settings/UI path only); no C ABI change; no new dependency (AGPL hygiene clean).
- User-visible default path change needs
CHANGELOG.md [Unreleased]entry;nota-docs/nota-featuresonly if maintainers deem the default-location change user-visible enough.
Open Questions
- [NEEDS CLARIFICATION: disabled-dir fallback — confirm
$HOME/Nota Projectsvs~/Documents/Nota ProjectswhenXDG_DOCUMENTS_DIR="$HOME".] - [NEEDS CLARIFICATION: should Windows also migrate existing custom-folder users, or only affect fresh defaults? Presumed defaults-only.]