huiyadanli/RevokeMsgPatcher · error · Exception

在路径{appPath}下,未找到app_launcher文件夹

Error message

在路径{appPath}下,未找到app_launcher文件夹

What it means

CreateLauncherFile(appPath) writes liteloader.h.js into <appPath>/app_launcher/. It throws a plain Exception if that subfolder is missing, because the expected QQNT application folder layout is either wrong or has changed.

Source

Thrown at RevokeMsgPatcher/Forms/FormLiteLoaderQQNT.cs:349

                        return Path.Combine(versionsPath, latestVersion, "resources", "app");
                    }
                }
            }

            return Path.Combine(installPath, "resources", "app");
        }

        /// <summary>
        /// 创建 app/app_launcher/liteloader.h.js 文件,写入 require(String.raw*) 其中 * 为 LiteLoaderQQNT 的路径
        /// </summary>
        /// <param name="appPath"></param>
        /// <exception cref="Exception"></exception>
        private void CreateLauncherFile(string appPath)
        {
            string launcherDir = Path.Combine(appPath, "app_launcher");
            if (!Directory.Exists(launcherDir))
            {
                throw new Exception($"在路径{appPath}下,未找到app_launcher文件夹");
            }

            string launcherFilePath = Path.Combine(launcherDir, "liteloader.h.js");
            // if (File.Exists(launcherFilePath))
            // {
            //     Debug.WriteLine("已经创建过liteloader.h.js文件");
            //     return;
            // }

            string liteLoaderPath = Path.Combine(Application.StartupPath, "LiteLoaderQQNT");
            string content = $"require(String.raw`{liteLoaderPath}`);";

            File.WriteAllText(launcherFilePath, content, Encoding.UTF8);
        }

        /// <summary>
        /// 修改 app/package.json 文件,将 main 后面的路径改为 ./app_launcher/liteloader.h.js
        /// </summary>

View on GitHub (pinned to 89cbbb3f0c)

Solutions

  1. Confirm the QQNT install path has versions\<ver>\resources\app\app_launcher.
  2. Reinstall a supported QQNT version to repair the app folder layout.
  3. Re-check that the chosen path is the QQNT root (the one containing QQ.exe).
Defensive patterns

Strategy: validation

Validate before calling

string launcherDir = Path.Combine(appPath, "app_launcher");
if (!Directory.Exists(launcherDir))
{
    MessageBox.Show($"{appPath} 下未找到 app_launcher 文件夹,请确认 QQNT 版本/路径。");
    return;
}
CreateLauncherFile(appPath);

Prevention

When it happens

Trigger: The appPath returned by GetAppPath exists but contains no app_launcher directory. Occurs with an unexpected/older QQNT build, a restructured app folder, or appPath mis-resolution (e.g. versions folder present but empty, falling through to <install>/resources/app).

Common situations: New QQNT version restructured its app folder; a non-standard install layout was selected; the versions subfolder was emptied.

Related errors


AI-assisted analysis of huiyadanli/RevokeMsgPatcher@89cbbb3f0c (2026-08-13). Data as JSON: /api/errors/8adda85715f8c555. Report an issue: GitHub.