mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-10 04:30:12 +02:00
Add an environment variable for custom temp dirs
This would be useful if you need to do some elaborate namespacing setup
and want all sockets and other temporary files in a single directory
instead of in `${XDG_RUNTIME_DIR:/tmp}`.
This resolves #139.
This commit is contained in:
@@ -6,6 +6,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||||||
and this project adheres to [Semantic
|
and this project adheres to [Semantic
|
||||||
Versioning](https://semver.org/spec/v2.0.0.html).
|
Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added an environment variable to choose a different directory for yabridge to
|
||||||
|
store its sockets and other temporary files in. This is only needed when
|
||||||
|
running the Wine process under a separate namespace. If you don't know that
|
||||||
|
you need this, then you probably don't need this!
|
||||||
|
|
||||||
## [3.6.0] - 2021-10-15
|
## [3.6.0] - 2021-10-15
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -668,7 +668,9 @@ the yabridge [Discord](https://discord.gg/pyNeweqadf).
|
|||||||
- If you're using a `WINELOADER` that runs the Wine process under a separate
|
- If you're using a `WINELOADER` that runs the Wine process under a separate
|
||||||
namespace while the host is not sandboxed, then you'll have to use the
|
namespace while the host is not sandboxed, then you'll have to use the
|
||||||
`YABRIDGE_NO_WATCHDOG` environment variable to disable the watchdog timer. If
|
`YABRIDGE_NO_WATCHDOG` environment variable to disable the watchdog timer. If
|
||||||
you know what this means then you probably know what you're doing.
|
you know what this means then you probably know what you're doing. In that
|
||||||
|
case, you may also want to use `YABRIDGE_TEMP_PATH` to choose a different
|
||||||
|
directory for yabridge to store its sockets and other temporary files in.
|
||||||
|
|
||||||
## Performance tuning
|
## Performance tuning
|
||||||
|
|
||||||
|
|||||||
+10
-1
@@ -32,9 +32,18 @@ using namespace std::literals::string_view_literals;
|
|||||||
*/
|
*/
|
||||||
constexpr char disable_watchdog_timer_env_var[] = "YABRIDGE_NO_WATCHDOG";
|
constexpr char disable_watchdog_timer_env_var[] = "YABRIDGE_NO_WATCHDOG";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If this environment variable is set, yabridge will store its sockets and
|
||||||
|
* other temporary files here instead of in `$XDG_RUNTIME_DIR` or `/tmp`. This
|
||||||
|
* is only relevant when using some namespacing setup for sandboxing.
|
||||||
|
*/
|
||||||
|
constexpr char temp_dir_override_env_var[] = "YABRIDGE_TEMP_PATH";
|
||||||
|
|
||||||
fs::path get_temporary_directory() {
|
fs::path get_temporary_directory() {
|
||||||
bp::environment env = boost::this_process::environment();
|
bp::environment env = boost::this_process::environment();
|
||||||
if (!env["XDG_RUNTIME_DIR"].empty()) {
|
if (!env[temp_dir_override_env_var].empty()) {
|
||||||
|
return env[temp_dir_override_env_var].to_string();
|
||||||
|
} else if (!env["XDG_RUNTIME_DIR"].empty()) {
|
||||||
return env["XDG_RUNTIME_DIR"].to_string();
|
return env["XDG_RUNTIME_DIR"].to_string();
|
||||||
} else {
|
} else {
|
||||||
return fs::temp_directory_path();
|
return fs::temp_directory_path();
|
||||||
|
|||||||
Reference in New Issue
Block a user