[yabridge] Warn on non-executable yabridge files

This commit is contained in:
Robbert van der Helm
2023-08-13 14:30:04 +02:00
parent 24b600f9d5
commit 2089c035d0
3 changed files with 26 additions and 7 deletions
+2 -1
View File
@@ -11,7 +11,8 @@ Versioning](https://semver.org/spec/v2.0.0.html).
### yabridgectl
- Some outdated warning messages have been updated to make yabridge's current
state.
state. There are also additional warnings when detecting common installation
issues.
### Packaging notes
+4 -1
View File
@@ -304,7 +304,10 @@ impl Config {
};
// `yabridge-host.exe` should either be in the search path, or it should be in
// `~/.local/share/yabridge` (which was appended to the `$PATH` at the start of `main()`)
// `~/.local/share/yabridge` (which was appended to the `$PATH` at the start of `main()`).
// `which()` also ensures that the files are executable. Some methods of extracting and
// copying archive strip the executable bit, in which case they will show up as not found
// here.
let yabridge_host_exe = which(YABRIDGE_HOST_EXE_NAME).ok();
let yabridge_host_exe_so = yabridge_host_exe
.as_ref()
+20 -5
View File
@@ -231,11 +231,26 @@ pub fn verify_path_setup() -> Result<bool> {
// First we'll check `~/.local/share/yabridge`, since that's a special location where yabridge
// will always search
let xdg_data_yabridge = config::yabridge_directories().map(|dirs| dirs.get_data_home());
let xdg_data_yabridge_exists = xdg_data_yabridge
.map(|data_home| data_home.join(YABRIDGE_HOST_EXE_NAME).is_executable())
.unwrap_or(false);
if xdg_data_yabridge_exists {
return Ok(true);
let xdg_yabridge_host_exe_path =
xdg_data_yabridge.map(|data_home| data_home.join(YABRIDGE_HOST_EXE_NAME));
match xdg_yabridge_host_exe_path {
Ok(path) if path.is_executable() => return Ok(true),
// If the file does exist but is not executable, it's almost certainly a mistake. This has
// happened once or twice before. Some archive extraction programs seem to strip the
// executable bits.
Ok(path) if path.exists() => {
eprintln!(
"\n{}",
wrap(&format!(
"WARNING: '{}' exists but is not executable. Something probably went wrong \
when extracting yabridge's files.",
path.display().to_string().bright_white(),
))
);
return Ok(false);
}
_ => (),
}
// Then we'll check the login shell, since DAWs launched from the GUI will have the same