gpt4 book ai didi

c++ - 查明文件路径是映射/远程还是本地

转载 作者:太空宇宙 更新时间:2023-11-04 16:11:17 25 4
gpt4 key购买 nike

是否可以确定驱动器路径(例如 P:/temp/foo)是本地的还是远程的?

此处 ( CMD line to tell if a file/path is local or remote? ) 显示了 cmd 评估,但我正在寻找 C++/Qt 方式。

相关:

  1. QDir::exists with mapped remote directory
  2. How to perform Cross-Platform Asynchronous File I/O in C++

最佳答案

在 Qt 中没有办法,至少到 Qt 5.5 为止。 QStorageInfo将是最合适的,但对于这样的 API 应该是什么样子还没有达成一致(请参阅开始的巨大讨论 in this thread ;基本上,Qt 报告误导信息的风险之一)。

因此,现在您可以使用 native API。前面提到的 GetDriveType 适用于 Windows,但在 Linux 和 Mac 上您几乎只能靠自己了。

关于c++ - 查明文件路径是映射/远程还是本地,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28414968/

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