最新消息:

UnicodePathTest是NSIS判断安装路径是否存在unicode字符的插件

nsis 永恒心锁 1697浏览 0评论
/*
UnicodePathTest是NSIS判断安装路径是否存在unicode字符的插件
有些程序不能安装在有某些特殊字符的路径中,所以安装程序需要提醒用户当前的安装路径并不合符要求.
Test for unicode path
UnicodePathTest::UnicodePathTest "path"
Pop $var
$var:
 "unicode" - path contains unicode chars
 "ascii" - path doesn't contain unicode chars
*/
!AddPluginDir "../Plugins"
;Include Modern UI
!include "MUI2.nsh"
Name "UnicodePathTest"
OutFile "UnicodePathTest.exe"
InstallDir "$PROGRAMFILESUnicode path test 煤"
; define function on leaving page directory dialog
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE DirectoryLeave
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Section
SectionEnd
; function which check path and show message box
Function DirectoryLeave
; test if path contains unicode characters
UnicodePathTest::UnicodePathTest $INSTDIR
Pop $R1
StrCmp $R1 "ascii" ascii_path
 messagebox mb_ok 'Path cannot contain special characters or diacritics!'
 abort
ascii_path:
messagebox mb_ok 'Path is ok!'; only for this example, remove in release
FunctionEnd
永恒心锁,版权所有丨如未注明,均为转载丨本网站采用BY-NC-SA协议进行授权

转载请注明:永恒心锁-分享互联网 » UnicodePathTest是NSIS判断安装路径是否存在unicode字符的插件

您必须 登录 才能发表评论!