[Cppfcplib] r14273 - in trunk/apps/CppFCPLib: . examples/message_sending
mkolar at freenetproject.org
mkolar at freenetproject.org
Mon Jul 23 11:54:06 UTC 2007
Author: mkolar
Date: 2007-07-23 11:54:06 +0000 (Mon, 23 Jul 2007)
New Revision: 14273
Modified:
trunk/apps/CppFCPLib/Node.cpp
trunk/apps/CppFCPLib/examples/message_sending/readme.txt
Log:
* system independent directory extraction when using put
Modified: trunk/apps/CppFCPLib/Node.cpp
===================================================================
--- trunk/apps/CppFCPLib/Node.cpp 2007-07-23 10:29:10 UTC (rev 14272)
+++ trunk/apps/CppFCPLib/Node.cpp 2007-07-23 11:54:06 UTC (rev 14273)
@@ -1,5 +1,6 @@
#include <boost/lexical_cast.hpp>
+#include <boost/filesystem.hpp>
#include <typeinfo>
#include <fstream>
#include <sstream>
@@ -485,10 +486,8 @@
// we want to read somethig from a filesystem
// extract dir
- size_t pos = filename.find_last_of("/\\");
- if ( pos == filename.npos )
- throw std::logic_error("Path to a file does not contain directory");
- std::string dir = std::string(filename, 0, pos);
+ boost::filesystem::path filePath( filename );
+ std::string dir = filePath.branch_path().string();
TestDDAResponse r = this->testDDA(dir, true, false); // read only
std::string filehash ( fields.hasField("FileHash") ? fields.getField("FileHash") : "" );
Modified: trunk/apps/CppFCPLib/examples/message_sending/readme.txt
===================================================================
--- trunk/apps/CppFCPLib/examples/message_sending/readme.txt 2007-07-23 10:29:10 UTC (rev 14272)
+++ trunk/apps/CppFCPLib/examples/message_sending/readme.txt 2007-07-23 11:54:06 UTC (rev 14273)
@@ -21,4 +21,4 @@
send_message.cpp
----------------
-Sending a data message to a server. Currently used only for testing.
\ No newline at end of file
+Sending a data message to a server. Currently used only for testing.
More information about the Cppfcplib
mailing list