POL_Function_SetNativeExtension
Informations
| Creator | Mensajes |
|---|---|
petch
|
InformationThis installer has been approved by the team. InformationsPlatforms: Feedbacks0 0 DescriptionAssociate the files of the given filename extension to their default application in the native (host) environment.
Source code#!/bin/bash
#Creator: petch
# Remove starting dot, if any
FILEXT="${1#.}"
# Lowercase
FILEXT="${FILEXT,,*}"
if [ -z "$FILEXT" ]; then
POL_Debug_Warning "$(eval_gettext 'No filename extension specified, skipping association to native application.')" "$TITLE"
return
fi
MIMETYPE=""
[ "$FILEXT" = "pdf" ] && MIMETYPE="application/pdf"
[ "$FILEXT" = "txt" ] && MIMETYPE="text/plain"
[ "$FILEXT" = "rtf" ] && MIMETYPE="application/rtf"
# Associate an extension with native app
# http://wiki.winehq.org/FAQ#head-91bf3f0a8ccbfab8dee96f82fae2f1a489e0d243
cat <<_EOF_ > "$REPERTOIRE/tmp/nativeext.reg"
REGEDIT4
[HKEY_CLASSES_ROOT\\.${FILEXT}]
@="${FILEXT}file"
"Content Type"="${MIMETYPE}"
[HKEY_CLASSES_ROOT\\${FILEXT}file\\Shell\\Open\\command]
@="winebrowser \\"%1\\""
_EOF_
POL_Wine regedit "$REPERTOIRE/tmp/nativeext.reg"
rm "$REPERTOIRE/tmp/nativeext.reg" |
Contributions
Filters:
Contribute| Member | Mensajes |
This site allows content generated by members, and we promptly remove any content that infringes copyright according to our Terms of Service. To report copyright infringement, please send a notice to dmca-notice@playonlinux.com