mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-06 19:40:10 +02:00
[yabridge] Warn on non-executable yabridge files
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user