Last active
December 10, 2015 15:19
-
-
Save cannorin/e3fab37af3a56073bda4 to your computer and use it in GitHub Desktop.
exe file handler for linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
[ $# -eq 0 ] && | |
{ | |
echo "Usage: exehandler filename" | |
exit 0 | |
} | |
[ -f $1 ] || | |
{ | |
echo exehandler: $1 not found | |
exit 1 | |
} | |
EXEPATH="$(realpath $1)" | |
checkdn=" | |
try | |
{ | |
System.Reflection.AssemblyName.GetAssemblyName(\"$EXEPATH\"); | |
Console.WriteLine(\"$EXEPATH is a .NET assembly.\"); | |
Environment.Exit(0); | |
} | |
catch(Exception e) | |
{ | |
Console.WriteLine(e); | |
Console.WriteLine(\"$EXEPATH is not a .NET assembly.\"); | |
Environment.Exit(1); | |
}" | |
echo $checkdn | csharp | |
if [ $? -ne 0 ]; then | |
shift; | |
wine $EXEPATH $* | |
else | |
shift; | |
mono $EXEPATH $* | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cp this to .local/share/applications/ | |
[Desktop Entry] | |
Type=Application | |
Name=EXE Handler | |
Exec=/usr/local/bin/exehandler %f | |
Categories=Other; | |
NoDisplay=true | |
MimeType=application/x-ms-dos-executable | |
Terminal=false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment