[Bug] Audacity fails to parse "~" tilde for user's home directory in export audio dialog

Problem Description:
When exporting audio, Audacity fails to interpret the “~” tilde on Linux, which should expand to the user’s home ($HOME) directory.

Steps to reproduce:

  1. Open Audacity
  2. Create some audio (e.g., generate 440 Hz sine wave for 1 second)
  3. Select All
  4. Click File-> Export Audio
  5. In the “Folder” field in the dialog box that pops up, enter “~/somedir”
  6. (optional?) set “WAV (Microsoft)”, Mono, 44100 Hz, Signed 16-bit PCM, Entire Project
  7. Click Export

Observed Behavior
The file will be saved in $HOME/~/somedir/untitled.wav. Note the inclusion of the string literal “~” in the path. $HOME refers to the environment variable where the user’s home directory is, usually something like /home/user/

Expected Behavior
The file should be saved in $HOME/somedir/untitled.wav. The “~” needs to expand to the home directory.

Environment
Artix Linux
Audacity 3.5.1

Other
This also invites disaster for an unsuspecting user, who might attempt to rm -rf the errant “~” directory and could end up with a very bad day.

I never felt any need for using a tilde in the export dialog.

Set the export directory in the Audacity settings to /Users/yourname - see image 1

When exporting, the preset directory is shown in the export dialog, and you can complete it with the path you like. See image 2.

The tilde in the context of file paths in Linux is a token that expands to the user’s home directory. Similar to the %APPDATA% variable in Windows.

It’s purpose is to make it such that you don’t have to type /home/youruser/.

It originated in 1970 with csh and has been standard in every flavor of *NIX.

All GTK+ file pickers support “~”, Qt, all shells, WSL, even MacOS.

I don’t see how your personal desire factors into the observation that this is broken functionality in the export audio dialog of Audacity. I’m not sure if that’s what you were trying to say, but I’m simply reporting that the functionality is broken. Creating a directory called “~” is especially broken behavior.

@AudacityUser7958

You really need to log issues/bugs like this on Muse’s GitHub issues log:

You will need a GitHub account for this, but those are free.

Peter.

Thanks. A Google search indicated that Audacity uses the forum for bug reports, which I thought was odd

Yes, but the Audacity developers seldom, if ever, visit the Forum - so GitHub is a much better place - plus there’s better tracking there.

Peter.

You don’t have to type anything like that if you use Audacity’s settings to define your home directory. You don’t even need to type the tilde and can “expand” your path as you like. But maybe you just want to complain because only you know how it really should work?

~ is just a single character

? This is how it should work on Linux and MacOS

I don’t understand your comment. Anyway the bug is in Github for tracking purposes.

This feature works in Audacity 3.2.4 and (as OP says) every other GTK+ and Qt file pickers. In my mind, this is a regression (it’s not a feature that I personally use often if ever, but it’s still useful for people who do use it).

If you open a project in a directory outside your home directory, the export file picker will default to that directory. If you want to export to somewhere under your home directory, it’s a useful shortcut to get back to your home directory.

No it doesn’t. I just verified: made a small recording (Audacity 3.5.1 / MacOS 12.7.4 Monterey) and saved it on an USB stick.
Quit Audacity.
Double-clicked the .aup3 project.
Selected “Export”
The export dialog shows me the exact path from my Audacity settings (which is a directory within my home directory).

Test it, if you don‘t believe it.

I just tested an export and it was in the same directory as the project itself. What’s actually happening is it probably defaulted to the last location that I exported to, rather than where the project is (which just happened to be the same location that I last exported to).

Regardless of how the current export directory is set, the tilde feature is useful for easily getting back to your home directory, and it was removed some time after 3.4.2.

1 Like