html 打开本地可执行文件
windows设置
import _winreg
path = u'C:\\FFM_FTP\\ffm_ftp.exe'
class createKey():
def __init__(self):
key = _winreg.CreateKey(_winreg.HKEY_CLASSES_ROOT, "FFM")
key_shell = _winreg.CreateKeyEx(key, 'shell', 0, _winreg.REG_CREATED_NEW_KEY)
key_shell_open = _winreg.CreateKeyEx(key_shell, 'open', 0, _winreg.REG_CREATED_NEW_KEY)
_winreg.SetValueEx(key, 'URL Protocol', 0, _winreg.REG_CREATED_NEW_KEY, u'URL:Go Protocol Handler')
_winreg.SetValue(key, 'Defaultlcon', _winreg.REG_CREATED_NEW_KEY,
path)
_winreg.SetValue(key_shell_open, 'command', _winreg.REG_CREATED_NEW_KEY,
path + ' FFM://ffm_ftp')
_winreg.FlushKey(key)
_winreg.CloseKey(key)
print 'set path is ok'
regedit = createKey()
linux设置
import os
from subprocess import call
desktop = '''
[Desktop Entry]
Name=FFM ftp
GenericName=Text Editor
Comment=Handle URL Scheme ffmftp://
Exec=/usr/local/FFM_FTP/ffm_ftp %u
Terminal=false
Type=Application
MimeType=x-scheme-handler/ffmftp;
Icon=sublime-text-2
Categories=TextEditor;Development;Utility;
Name[en_US]=FFM ftp
'''
handler = '''
#!/usr/bin/env bash
request="${1#*://}" # Remove schema from url (ffm_ftp://)
request="${request#*?url=}" # Remove open?url=
request="${request//%2F//}" # Replace %2F with /
r