Questions tagged [std-filesystem]

c++ std::filesystem discussion, std::filesystem was added to the ISO C++ standard library in C++17

Specification available from http://en.cppreference.com/w/cpp/filesystem

165 questions
5
votes
1 answer

Does llvm 9 support std::filesystem on versions of the mac prior to 10.15?

I have an old Mac (circa 2009) running El Capitan version 10.11.6. Apple doesn't allow further updates of its OS on my machine, but through Macports it serves as a fine development environment for non-Apple-specific software. I'm compiling with…
Curious
  • 128
  • 5
4
votes
0 answers

create all folder in a big path (with subfolders)

Im trying to create all folder in a path that reach to a file, for that by a little search I found out about std::filesystem::create_directories its ok but the problem of using it is looks like its can't handle long paths with so many subfolders,…
file-tracer
  • 329
  • 1
  • 7
4
votes
2 answers

Why can't I insert this transformed directory_iterator into a vector?

I am trying to insert a transformed range of directory entries into a vector using its insert(const_iterator pos, InputIt first, InputIt last) member function template. Unfortunately I can't get the following code to compile under GCC 11.1.0, which…
neop
  • 89
  • 2
  • 9
4
votes
1 answer

std:: has no member "filesystem" in C++/17

I'm trying to include , but when I use a namespace, it shows this error: std:: has no member "filesystem" I know in older times it is and namespace is std::experimental::filesystem; but, when i does this, it…
4
votes
0 answers

std::filesystem::relative bug in Mingw or msvc?

I have the following code snipped, which produces the following output on mingw(gcc) and msvc: std::cout << std::filesystem::relative("D:/home/freddy", "C:/home") << std::endl; mingw(gcc): "\\home\\freddy" msvc: "" gcc and also clang (both…
Fabian Keßler
  • 563
  • 3
  • 12
4
votes
1 answer

Lexical compare std::filesystem::path case insensitive?

My issue is something like the following: to determine if two paths are identical on the windows platform, paths are compared case insensitive, ei. "C:\test.txt" and "C:\Test.txt" resolves to the same file element. I could solve this easily by using…
darune
  • 10,480
  • 2
  • 24
  • 62
4
votes
1 answer

What are the possible error codes that can be returned when calling std::filesystem::copy()?

I can't seem to find a list of error codes that might be passed into the ec parameter for std::filesystem::copy. cppreference.com seems to indicate that the error codes are OS-specific.Looking at the Microsoft documentation (As I'm specifically…
Dan Forever
  • 381
  • 2
  • 12
4
votes
2 answers

How can a std::filesystem root path have itself as a parent?

This program: #include #include int main() { std::filesystem::path p1("c:\\"); std::filesystem::path p2("c:/"); if (p1.has_parent_path()) std::cout << "Parent path of " << p1 << " is " << p1.parent_path()…
Joe
  • 5,394
  • 3
  • 23
  • 54
4
votes
2 answers

Python bindings using pybind11 with std::filesystem as function argument giving TypeError

I have a class Foo() and class Foo() has a function with the following declaration: bool Foo::copyFile(const std::filesystem::path& src, const std::filesystem::path& dest) The requirement is that the class Foo should have Python bindings. I am using…
user304255
  • 121
  • 1
  • 7
4
votes
1 answer

What library to link to for std::filesystem with Xcode

Xcode 10.2 now includes the header. However, when writing code using std::filesystem, I'm running into a lot of extra link errors. Undefined symbols for architecture x86_64: "std::__1::__fs::filesystem::path::__filename() const",…
leecbaker
  • 3,611
  • 2
  • 35
  • 51
4
votes
1 answer

How to retrieve the clock type of std::filesystem::file_time_type in C++17

Since std::filesystem::file_time_type uses a trivial clock in C++17, is there a way to retrieve the actual clock type of file_time_type with C++17**? The goal is to convert the time to std::chrono::system_clock to use it e.g. in a stream. ** In…
Roi Danton
  • 7,933
  • 6
  • 68
  • 80
4
votes
1 answer

Compile error when std::filesystem header file is added to my program

I am trying to compile a simple C++ program with std::filesytem header file included! #include #include int main() { std::cout << "Hello, World!" << std::endl; return 0; } On compiling I get the following error In…
4
votes
0 answers

How similar are boost::filesystem and std::filesystem?

I believe boost::filesystem was at least one of the "source" libraries used to design std::filesystem for C++17. How similar are they? If very similar, what are the known gotchas and incompatibilities? If not, where are they similar? This is in…
Yakk - Adam Nevraumont
  • 262,606
  • 27
  • 330
  • 524
3
votes
1 answer

How to skip/disregard files with names that use wide characters using std::filesystem?

I am iterating through a large set of nested directories searching for files of some extension, say ".foo" using code like the following: namespace fs = std::filesystem; int main(int argc, char* argv[]) { std::ios_base::sync_with_stdio(false); …
jwezorek
  • 8,592
  • 1
  • 29
  • 46
3
votes
2 answers

I don't know how to use filesystem to look for .txt files c++

I would like to use std::filesystem in my project, which will allow me to show .txt files in the current directory (I use Ubuntu, I don't need a Windows function because I have already seen one on StackOverflow). Here is my GitHub…
Eriss69
  • 69
  • 5
1 2
3
10 11