gpt4 book ai didi

c# - 文件存在于 WPF 中

转载 作者:太空狗 更新时间:2023-10-30 00:29:01 24 4
gpt4 key购买 nike

if (!File.Exists("SomeFile.exe"))
{
//Does not exists
}

我在与 exe 相同的路径中有 SomeFile.exe,但结果是不存在。

Windows 窗体中不会发生这种情况,有什么变化吗?

最佳答案

试试这个来获取可执行文件目录中的文件。

string directory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
string filePath = Path.Combine(directory, "SomeFile.exe");

if (!File.Exists(filePath))
{
// 1337 code here plx.
}

关于c# - 文件存在于 WPF 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1356427/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com