jjzjj

fileSystem

全部标签

android - PhoneGap FileTransfer.download 期望的路径与 FileSystem 提供的路径不同

我正在将文件下载到本地文件系统。我可以通过fileSystem.root.getFile成功创建空文件,但fileTransfer.download失败并显示FILE_NOT_FOUND_ERR,即使它使用相同的路径也是如此。问题是我的文件是在//sdcard/MyDir/test.pdf中创建的(我确认使用adbshell)但是fileEntry返回了一个路径没有sdcard://MyDir/test.pdf。fileTransfer.download使用此路径失败。它也因相对路径MyDir/test.pdf而失败。如果我在其中使用“sdcard”对完整路径进行硬编码,我可以避免FI

android - 使用 Expo.Filesystem.downloadAsync 下载大量文件有时会无限期地卡住

我正在使用Expo.Filesystem.downloadAsync下载大号。图像和视频等文件。但它有时会在某个时刻无限期地卡住。我想在循环内下载文件。代码是:letimage_downloading=section.map(async(item,i)=>{item.image!==null?awaitFileSystem.downloadAsync(item.image,directory+item.image.split("/").reverse()[0]).then(({uri})=>{item['image']=uri;console.log('Finisheddownload

c++ - boost::filesystem::path::lexically_normal: 这是不正确的行为吗?

boost::filesystem::path::lexically_normal()的文档指出:Returns*thiswithredundantcurrentdirectory(dot),parentdirectory(dot-dot),anddirectory-separatorelementsremoved.参见:http://www.boost.org/doc/libs/1_63_0/libs/filesystem/doc/reference.html.以下打印./test(使用Boost1.63.0),我希望test:#include#includeintmain(void

c++ - 在 Windows 上获取 boost::filesystem::path 作为 UTF-8 编码的 std::string

我们将路径表示为boost::filesystem::path,但在某些情况下,其他API期望它们为constchar*(例如,打开一个数据库使用SQLite文件)。来自thedocumentation,path::value_type在Windows下是一个wchar_t。据我所知,Windowswchar_t是2个字节,UTF-16编码。有一个string()返回std::string的native观察者,同时说明:Ifstring_typeisadifferenttypethanString,conversionisperformedbycvt.cvt被初始化为默认构造的code

c++ - 删除 .. 在 boost filesystem::complete

这应该很简单:我正在使用boost文件系统编写绝对路径,但它返回的路径非常丑陋:D:/Projects/SomeDir/vc10/../resource/plugins/SomeFile.dll是否有自动处理.'s和..'s的boost方法?我所做的是:boost::filesystem::complete("../resource/plugins/SomeFile.dll")它使用boost::filesystem2。 最佳答案 boost::filesystem::complete("../resource/plugins/So

c++ - 如何使用 Boost Filesystem 忽略隐藏文件(和隐藏目录中的文件)?

我正在使用以下递归地遍历目录中的所有文件:try{for(bf::recursive_directory_iteratorend,dir("./");dir!=end;++dir){constbf::path&p=dir->path();if(bf::is_regular_file(p)){std::cout但这包括隐藏文件和隐藏目录中的文件。如何过滤掉这些文件?如果需要,我可以将自己限制在隐藏文件和目录以“.”开头的平台上。性格。 最佳答案 不幸的是,似乎没有跨平台的方式来处理“隐藏”。以下适用于类Unix平台:首先定义:bool

c++ std::bad_alloc on std::filesystem::path 追加

我遇到了一个非常奇怪的行为,我将其提炼为一个非常基本的测试:#include#includeintmain(void){conststd::stringname="foo";conststd::filesystem::pathlock_dir="/tmp";std::filesystem::pathlockfile=lock_dir/name;return0;}我用g++-std=c++17-Wall-Wextra-Werror-gfoo.cpp-ofoo编译它。当我运行它时,我在附加两条路径的行上得到一个std::bad_alloc异常。这是我用gdb看到的#0__GI_raise(

c++ - 如何将 'const boost::filesystem2::path' 变成 'const char *' ?

如何将“constboost::filesystem2::path”转换为“constchar*”? 最佳答案 尝试使用path::string().c_str() 关于c++-如何将'constboost::filesystem2::path'变成'constchar*'?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/4875482/

c++ - std::filesystem::directory_iterator 链接器问题 (C++17)

这个问题在这里已经有了答案:LinkerrorsusingmembersinC++17(4个答案)关闭4年前。在尝试使用C++17标准中的std::filesystem::directory_iterator时,我的C++构建出现问题。代码如下:std::vectorIO::getDirectoryList(std::filesystem::path&dirPath){std::vectorfiles;for(auto&file:std::filesystem::directory_iterator(".")){files.push_back(file.path());}returnf

c++ - 从 boost::filesystem::is_directory 捕获异常

我目前正在捕获来自boost::filesystem::is_directory的错误,并通过在异常上调用“what()”向用户显示错误。这给出了失败的原因,但错误对用户来说很奇怪。例如:boost::filesystem::is_directory:Accessisdenied我如何捕获boost错误并找出实际原因,以便显示更好的错误消息? 最佳答案 “更好的错误信息”是指类似的东西吗#include#includeintmain(){boost::filesystem::pathp("/proc/1/fd/1");try{boo