检查文件的使用相对路径存在 [英] Checking the existence of a file using relative path
本文介绍了检查文件的使用相对路径存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
什么是检查使用相对路径的文件是否存在的最佳方法。
我用下面的方法,但尽管该文件返回false 。在现有的
布尔A = File.Exists(/图片/ Customswipe_a.png);
解决方案
这不是一个相对路径。你需要离开过第一 /
否则将被解释为植根(即C:/图像...)
What is the best way to check the existence of a file using relative path.
I've used the following method but it returns false despite the fact that file is existing.
bool a = File.Exists("/images/Customswipe_a.png");
解决方案
That's not a relative path. You need to leave off the first /
otherwise it will be interpreted as being rooted (i.e. C:/images...)
这篇关于检查文件的使用相对路径存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文