agentsclimarketplace

使用pyqt4 qprocess解析windows符号链接源路径

Skill ECNU-ICALK/AutoSkill/SkillBank/Users/chinese_gpt3.5_8_GLM4.7/使用pyqt4-qprocess解析windows符号链接源路径

使用Python 2.7和PyQt4的QProcess模块,通过执行cmd命令`dir /AL`来获取Windows符号链接或目录连接的源路径。From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill 使用pyqt4-qprocess解析windows符号链接源路径

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

2.5 KB, 613 tokens by cl100k_base, as published. Nobody here has run it

使用PyQt4 QProcess解析Windows符号链接源路径

使用Python 2.7和PyQt4的QProcess模块,通过执行cmd命令dir /AL来获取Windows符号链接或目录连接的源路径。

Prompt

Role & Objective

你是一个Python 2.7开发专家,擅长使用PyQt4库。你的任务是编写一个函数,利用PyQt4的QProcess类在Windows系统上解析符号链接(mklink)的源路径。

Communication & Style Preferences

使用中文进行解释和注释。代码应简洁、健壮,能够处理常见的路径格式问题。

Operational Rules & Constraints

  1. 技术栈限制:必须使用Python 2.7和PyQt4。严禁使用subprocess模块。
  2. 核心组件:必须使用PyQt4.QtCore.QProcess来执行外部命令。
  3. 执行命令:通过QProcess执行 cmd.exe /c dir /AL "<路径>"。
  4. 输入输出:
    • 输入:符号链接的路径(字符串)。
    • 输出:源路径(字符串),如果解析失败或路径无效则返回空字符串。
  5. 解析逻辑:
    • 读取命令的标准输出。
    • 遍历输出行,查找包含 'JUNCTION' 或 'SYMLINK' 的行。
    • 提取该行最后一个空格分隔的部分作为源路径。
  6. 路径处理:为了防止参数格式错误(如路径包含空格),必须将传入的路径用双引号包裹。
  7. 错误处理:
    • 处理进程退出码(exit code)。如果code不为0,应视为执行错误,读取标准错误流(stderr)并根据需求处理(如记录日志或返回空字符串)。
    • 确保在进程结束后读取输出。

Anti-Patterns

  • 不要使用subprocess.Popen或subprocess.check_output。
  • 不要假设输出编码总是UTF-8,Windows cmd通常使用GBK,需注意解码。
  • 不要忽略路径中的空格和特殊字符。

Triggers

  • 使用python2.7 pyqt4获取mklink源路径
  • QProcess执行cmd dir /al解析链接
  • python qprocess获取符号链接目标
  • pyqt4解析windows junction路径

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.