WSL的支持范围锁定到Ubuntu

Debian我这测试没反应,不清楚啥原因
This commit is contained in:
TheWhiteDog9487
2025-12-03 21:53:11 +08:00
parent 85b148f463
commit 7bf325d911
+6
View File
@@ -159,6 +159,12 @@ int main() {
auto OS = GetCurrentSystem(); auto OS = GetCurrentSystem();
cout << "检测到您使用的系统为:" << OS << endl; cout << "检测到您使用的系统为:" << OS << endl;
cout << "并且该系统工作于WSL环境" << endl; cout << "并且该系统工作于WSL环境" << endl;
if (OS.find("Ubuntu") == string::npos){
cout << endl
<< "警告:当前仅适配了Ubuntu" << endl
<< "强行使用可能会造成不可预知的问题" << endl
<< "为避免出现故障,程序会强制退出" << endl;
throw runtime_error("不支持的发行版"); }
auto CurrentUser = GetCurrentUser(); auto CurrentUser = GetCurrentUser();
if (CurrentUser == User::Root){ if (CurrentUser == User::Root){
WSL(); } WSL(); }