boost-filesystem

how to subtract one path from another?

╄→尐↘猪︶ㄣ 提交于 2020-01-14 10:43:29
问题 So... I have a base path and a new path.New path contains in it base path. I need to see what is different in new path. Like we had /home/ and new path is /home/apple/one and I need to get from it apple/one. note - when I would create some path from (homePath/diffPath) I need to get that /home/apple/one again. How to do such thing with Boost FileSystem? 回答1: Using stem() and parent_path() and walk backwards from the new path until we get back to base path, this works, but I am not sure if it

how to subtract one path from another?

折月煮酒 提交于 2020-01-14 10:43:08
问题 So... I have a base path and a new path.New path contains in it base path. I need to see what is different in new path. Like we had /home/ and new path is /home/apple/one and I need to get from it apple/one. note - when I would create some path from (homePath/diffPath) I need to get that /home/apple/one again. How to do such thing with Boost FileSystem? 回答1: Using stem() and parent_path() and walk backwards from the new path until we get back to base path, this works, but I am not sure if it

how to subtract one path from another?

时光毁灭记忆、已成空白 提交于 2020-01-14 10:43:06
问题 So... I have a base path and a new path.New path contains in it base path. I need to see what is different in new path. Like we had /home/ and new path is /home/apple/one and I need to get from it apple/one. note - when I would create some path from (homePath/diffPath) I need to get that /home/apple/one again. How to do such thing with Boost FileSystem? 回答1: Using stem() and parent_path() and walk backwards from the new path until we get back to base path, this works, but I am not sure if it

how to subtract one path from another?

不羁岁月 提交于 2020-01-14 10:43:00
问题 So... I have a base path and a new path.New path contains in it base path. I need to see what is different in new path. Like we had /home/ and new path is /home/apple/one and I need to get from it apple/one. note - when I would create some path from (homePath/diffPath) I need to get that /home/apple/one again. How to do such thing with Boost FileSystem? 回答1: Using stem() and parent_path() and walk backwards from the new path until we get back to base path, this works, but I am not sure if it

How to check for new files in the directory?

走远了吗. 提交于 2020-01-12 03:53:46
问题 Given: filesystem::path toDir("./"); ptime oldTime; ptime now(second_clock::local_time()); How can I determine which files were created in the time period between oldTime and now ? The names of such "fresh" files should be streamed to cout . Update: Well based on given answer I made a small programm: #include <sstream> #include <stdio.h> #include <time.h> #include <boost/filesystem.hpp> #include <boost/thread.hpp> #include <boost/timer.hpp> #include <boost/date_time.hpp> #include <boost/date

boost.filesystem create_directories throws std::bad_alloc

喜夏-厌秋 提交于 2020-01-11 09:09:50
问题 I have a Visual Studio 2008 C++03 application using Boost 1.47.0 running in Windows XP SP3. The call boost::filesystem::create_directories( L"c:\\foo\\bar" ); throws a std::bad_alloc exception. In the output window, I see a debug heap message: "HEAP[test.exe]: Invalid allocation size - CDCDCDCE (exceeded 7ffdefff)" The callstack shows boost.filesystem creating a new locale and last visible line of code in the Microsoft standard library file xlocale line 309. msvcp90.dll!std::_Allocate<char>()

Attempting to use Boost.Filesystem however it doesn't seem to link?

柔情痞子 提交于 2020-01-04 13:47:49
问题 I'm using OS X 10.7.3. I've been playing with the boost headers for a while now and i wanted to move onto using the Boost.Filesystem lib however it keeps throwing this message at me: Undefined symbols for architecture x86_64: "boost::system::generic_category()", referenced from: __static_initialization_and_destruction_0(int, int)in ccOhIhNG.o boost::filesystem3::detail::create_directories(boost::filesystem3::path const&, boost::system::error_code*)in libboost_filesystem.a(operations.o) boost:

Attempting to use Boost.Filesystem however it doesn't seem to link?

♀尐吖头ヾ 提交于 2020-01-04 13:47:05
问题 I'm using OS X 10.7.3. I've been playing with the boost headers for a while now and i wanted to move onto using the Boost.Filesystem lib however it keeps throwing this message at me: Undefined symbols for architecture x86_64: "boost::system::generic_category()", referenced from: __static_initialization_and_destruction_0(int, int)in ccOhIhNG.o boost::filesystem3::detail::create_directories(boost::filesystem3::path const&, boost::system::error_code*)in libboost_filesystem.a(operations.o) boost:

Why can't I change the 'last write time' of my newly created files?

◇◆丶佛笑我妖孽 提交于 2019-12-31 05:19:05
问题 First off, I'm using Visual Studio 2015's implementation of the Filesystem library from the upcoming C++17 standard, which is based on Boost::Filesystem. Basically, what I'm trying to do is save a file's timestamp (it's "last write time"), copy that file's contents into an archive along with said timestamp, then extract that file back out and use the saved timestamp to restore the correct "last write time". // Get the file's 'last write time' and convert it into a usable integer. __int64

Why does std::filesystem::path::append replace the current path if p starts with root path

守給你的承諾、 提交于 2019-12-24 05:04:22
问题 Given below code: #include <iostream> #include <filesystem> namespace fs = std::filesystem; int main() { fs::path fsBase = "/base"; fs::path fsAppend = "/append"; auto fsResult = fsBase / fsAppend; std::cout << "fsResult: " << fsResult << std::endl; return 0; } Usually, the expected result is /base/append , but it actually gives /append . The description of fs::path::append does indicate this behavior: If p.is_absolute() || (p.has_root_name() && p.root_name() != root_name()), then replaces