马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
制作工具箱时,采用的“支持文件搜索路径”,本代码由网上的整合而成,感谢分享代码的各位大大。
代码写得比较粗糙,如有更好的请帮忙指正。 - (defun 支持文件搜索路径_lst()
- (setq acad_lst (getenv "ACAD"))
- ;将字符串字符串以 给定 Key 分解成
- ;例:(EF:String->list "a,b,c" ",") →("a" "b" "c")
- (defun EF:String->list (sSource sDelimiter / lenSource lenDelimiter iPos lstResult)
- (if (= sDelimiter "") (progn (princ "EF:String->list 分割参数不能为空字符""") (exit)))
- (setq
- lenSource (strlen sSource)
- lenDelimiter (strlen sDelimiter)
- )
- (while (setq iPos (vl-string-search sDelimiter sSource))
- (setq
- lstResult (cons (substr sSource 1 iPos) lstResult)
- sSource (substr sSource (+ 1 iPos lenDelimiter))
- )
- )
- (reverse (cons sSource lstResult))
- ) ;_ end EF:String->list
- ;从列表中移去指定的元素
- (defun drop (lst item)
- (append (reverse (cdr (member item (reverse lst))))
- (cdr (member item lst))
- )
- )
- (defun GetMyApplicationPath (AppID)
- (vl-registry-read
- (strcat
- "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\"
- AppID
- "_is1"
- )
- "Inno Setup: App Path"
- )
- )
- (defun EC:Stru:GT:GetPath ()
- (GetMyApplicationPath "Gavin")
- )
- (setq acad_lsts (EF:String->list acad_lst ";"))
- (setq acad_lsts1 (foreach x (list ""
- (EC:Stru:GT:GetPath)
- (strcat (EC:Stru:GT:GetPath) "\\LISP")
- (strcat (EC:Stru:GT:GetPath) "\\菜单")
- (strcat (EC:Stru:GT:GetPath) "\\其它")
- (strcat (EC:Stru:GT:GetPath) "\\其它\\Vlisp 开发小助手2010版")
- (strcat (EC:Stru:GT:GetPath) "\\书籍")
- (strcat (EC:Stru:GT:GetPath) "\\EXE")
- )
- (setq acad_lsts (drop acad_lsts x))))
- ;将字符串列表以 给定 字符串连接
- ;例:(EF:List->string ("a" "b" "c") ",") →"a,b,c"
- (defun EF:List->String (lstString Delimiter / str return)
- (setq return (car lstString)
- lstString (cdr lstString)
- )
- (foreach str lstString
- (setq return (strcat return Delimiter str))
- ) ;_ end of foreach
- return
- );end EF:List->string
- (setq acad_lsts2 (EF:List->string acad_lsts1 ";"))
- (setq tmp (strcat (EC:Stru:GT:GetPath) ";"
- (strcat (EC:Stru:GT:GetPath) "\\LISP") ";"
- (strcat (EC:Stru:GT:GetPath) "\\菜单") ";"
- (strcat (EC:Stru:GT:GetPath) "\\其它") ";"
- (strcat (EC:Stru:GT:GetPath) "\\其它\\Vlisp 开发小助手2010版") ";"
- (strcat (EC:Stru:GT:GetPath) "\\书籍") ";"
- (strcat (EC:Stru:GT:GetPath) "\\EXE") ";"
- acad_lsts2 ";"))
- (setenv "ACAD" tmp)
- )
- (支持文件搜索路径_lst)
- (princ)
|