goreliu / runz

RunZ,专业的快速启动工具

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

反馈,部分需要设置工作目录的程序启动失败

aleegreat opened this issue · comments

例如Uget在启动时,需要设置工作目录是uget.exe所在目录,否则会导致aria2c启动失败。
以下是是个小补丁,作者大人看一下如果没啥问题的话,可以考虑合并进Runz。

  1. runz.ahk 中新增func如下:
getCMDWorkDir(cmdPath)
{
	FileGetAttrib, OutputVar ,cmdPath
	if OutputVar contains "D"
		return cmdPath
	else
		SplitPath, cmdPath,, parentDir
		return parentDir
}
  1. 修改runz.ahk 中func:RunCommand
    找到以下代码位置
if (Arg == "")
        {
            Run, %cmd%
        }
        else
        {
            Run, %cmd% "%Arg%"
        }

修改为:

        ;设置命令工作目录
        parentDir :=getCMDWorkDir(cmd)
        SetWorkingDir, %parentDir%
        if (Arg == "")
        {
            Run, %cmd%
        }
        else
        {
            Run, %cmd% "%Arg%"
        }

谢谢,已经添加了相关代码。