mirror of
https://github.com/storytold/photocraft.git
synced 2026-11-21 09:26:43 +00:00
fix(macos): bundle the CLI and resolve it from generated droplets
This commit is contained in:
1 parent
0cdd537480
commit
8a6ce79c6f
1 file changed
+14
-3
@@ -328,9 +328,20 @@ fn write_shim(droplet: &str) -> Result<String> {
|
||||
// quoted segment, emit a literal quote, then resume it.
|
||||
let quoted_abs = format!("'{}'", abs.replace('\'', "'\\''"));
|
||||
let body = format!(
|
||||
"#!/bin/sh\n# PhotoCraft droplet: runs the action on the files given (or dropped).\nexec \"${{PHOTOCRAFT_CLI:-photocraft-cli}}\" droplet {quoted_abs} \"$@\"\n"
|
||||
);
|
||||
crate::file_cmds::write_file(&shim, body.as_bytes())?;
|
||||
r#"#!/bin/sh
|
||||
# PhotoCraft droplet: runs the action on the files given (or dropped).
|
||||
if [ -n "${{PHOTOCRAFT_CLI:-}}" ]; then
|
||||
cli="$PHOTOCRAFT_CLI"
|
||||
elif [ -x /Applications/PhotoCraft.app/Contents/MacOS/photocraft-cli ]; then
|
||||
cli=/Applications/PhotoCraft.app/Contents/MacOS/photocraft-cli
|
||||
elif [ -x "$HOME/Applications/PhotoCraft.app/Contents/MacOS/photocraft-cli" ]; then
|
||||
cli="$HOME/Applications/PhotoCraft.app/Contents/MacOS/photocraft-cli"
|
||||
else
|
||||
cli=photocraft-cli
|
||||
fi
|
||||
exec "$cli" droplet {quoted_abs} "$@"
|
||||
"#
|
||||
); crate::file_cmds::write_file(&shim, body.as_bytes())?;
|
||||
#[cfg(unix)]
|
||||
{
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
|
||||
Reference in new issue
Block a user