我正在研究一個程序,它需要在用戶定義的目錄中查找文件。如果文件不存在,它必須繼續使用它自己的資源。問題是,即使某些文件不存在,函數File.Exists也會爲它們返回true。File.Exists返回True時應該是False
以下是錯誤的圖像:
下面是查找文件併產生錯誤代碼:
string[] vmtLines = null;
if (File.Exists(vmtFile))
{
try { vmtLines = File.ReadAllLines(vmtFile); }
catch (Exception e) { Debug.Log(vmtFile + " Exists: " + File.Exists(vmtFile) + ", " + e.Message); }
}
vmtFile聲明在哪裏? – Programmer
如果說它存在,框架沒有被破壞的可能性很高。你刷新,重新排序,啓用顯示隱藏和系統文件等? –
對不起,我剛剛解決它,據說。謝謝你讓我知道,而且它現在還在破碎? –