Skip to content

Instantly share code, notes, and snippets.

@cappuccino
Created April 21, 2010 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cappuccino/374461 to your computer and use it in GitHub Desktop.
Save cappuccino/374461 to your computer and use it in GitHub Desktop.
#!/bin/bash
# replaces the Chrome executable with a script which calls the original executable with the -allow-file-access-from-files argument.
# pass the path to the Chrome executable as the first argument.
original_path="$1"
base="$(basename "$original_path")"
new_path="$(dirname "$original_path")/$base-bin"
if [ ! -f "$original_path" ] || [ ! -x "$original_path" ]; then
echo "not an executable"
exit 1
fi
if [ -f "$new_path" ]; then
echo "already patched"
exit 1
fi
mv "$original_path" "$new_path"
echo '#!/bin/bash' > "$original_path"
echo "exec \"\${0%/*}/$base-bin\" -allow-file-access-from-files \"\$@\"" >> "$original_path"
chmod +x "$original_path"
@cappuccino
Copy link
Author

Only tested on OS X, might work on Linux though.

Relevant Chrome issue: http://code.google.com/p/chromium/issues/detail?id=37586

@meelash
Copy link

meelash commented Apr 21, 2010

Thanks Tom, this is VERY helpful....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment