新版本1.2.0包含一个终端,但是当我尝试安装任何带有节点的包时,我得到了npm ERR!我经常解决的代码EPERM右键单击并以管理员身份运行它.那我怎么在vscode终端那样做呢?linux有sudo之类的东西吗?
我正在尝试编写一个函数来确定文件是否存在.这两种方法证明返回不一致的结果(fileExists()似乎提供了准确的结果,与isFileFound()相比,它返回误报 - 我试图创建实例时会发生异常).
protected bool isFileFound(string path, string fileName)
{
System.IO.FileInfo fi = null;
bool found = false;
try
{
fi = new System.IO.FileInfo(path + fileName);
found = true;
}
catch (Exception e)
{
baselogger.Fatal(e.Message + " " + e.StackTrace + " \n" + path + fileName);
}
return found;
}
protected bool fileExists(string path, string pattern)
{
bool success = false;
try
{
success = File.Exists(path + pattern);
}
catch (Exception e)
{
baselogger.Warn(e.Message + " " + e.StackTrace …Run Code Online (Sandbox Code Playgroud) System.IO.File.Exists(string path)
Run Code Online (Sandbox Code Playgroud)
即使文件存在于指定路径上,也始终返回false.可能的解决方案是什么?
我目前正在研究一个遍历各种目录的程序,以确保使用特定文件File.Exists().
该应用程序声称某些文件实际上不存在,我最近发现此错误是由于路径太长.
我意识到有关SO的问题可以解决File.Exists()返回错误值的问题,但似乎没有解决这个特定问题.
重命名目录和文件以缩短路径实际上不是一个选项,所以我不知道该做什么.是否有解决此问题的解决方法?
使用中的代码没有什么特别之处(我已经删除了一些不相关的代码),但我会在下面包含它以防万一它有所帮助.
private void checkFile(string path)
{
if (!File.Exists(path))
Console.WriteLine(" * File: " + path + " does not exist.");
}
Run Code Online (Sandbox Code Playgroud) 我有一个问题,我无法访问映射文件夹中的任何文件
我的驱动器 N: 映射到 \erpu9\clients\,我有 1.txt 文件,我正在尝试读取。
函数返回File.Exists(@"N:\1.txt")false,但File.Exists(@"\\erpu9\clients\1.txt")返回true。FileInfo.Exists 中也发生了同样的事情。
当我尝试运行时File.ReadAllLines(@"N:\1.txt")出现异常:找不到路径“n:\1.txt”的一部分,但File.ReadAllLines(@"\\erpu9\clients\1.txt")工作正常
我真的迷路了,有什么建议吗?
如果相关,我正在使用 Windows 10、VS2013