[feature request] Configurable /tmp directory
johnhamelink opened this issue · 2 comments
Is your feature request related to a problem? Please describe.
When trying to share 400GB of content that was stored on an external drive, the transfer failed because portal was copying the file to /tmp before sending. The /tmp directory only has access to around 50GB of space on this machine.
Describe the solution you'd like
If I could change the directory to one relative to the content being sent, or otherwise configure the working directory for portal, then I could transfer these larger files on this device.
Describe alternatives you've considered
I looked through --help, README, and checked for any relevant issues or PRs.
At least on Linux, you can set the TMPDIR
environment variable to any directory:
TMPDIR="$HOME/.cache" portal send <files...>
You can do this on the receiving end as well:
TMPDIR="$HOME/.cache" portal receive <code>
Once that's finished, remove the temporary files in both machines manually:
rm ~/.cache/portal-*-temp*
Thank you @DullUnicorn!
We use the TempDir function from the os package (https://pkg.go.dev/os#TempDir).
Both on Unix systems and on Windows, this directory is configurable, so you can set/re-set it before and after transfer just as described above.
Excerpt from os.TempDir docs:
- On Unix systems, it returns $TMPDIR if non-empty, else /tmp.
- On Windows, it uses GetTempPath, returning the first non-empty value from %TMP%, %TEMP%, %USERPROFILE%, or the Windows directory.
- On Plan 9, it returns /tmp.