forked from premiere/premiere-libtorrent
fixes issue whith failure to create logs causes libtorrent to quit, fixes ticket #168
This commit is contained in:
parent
9bcb4e9f09
commit
f20cf1b92f
|
@ -60,10 +60,17 @@ namespace libtorrent
|
|||
{
|
||||
logger(fs::path const& filename, int instance, bool append = true)
|
||||
{
|
||||
fs::path dir(fs::complete("libtorrent_logs" + boost::lexical_cast<std::string>(instance)));
|
||||
if (!fs::exists(dir)) fs::create_directories(dir);
|
||||
m_file.open((dir / filename).string().c_str(), std::ios_base::out | (append ? std::ios_base::app : std::ios_base::out));
|
||||
*this << "\n\n\n*** starting log ***\n";
|
||||
try
|
||||
{
|
||||
fs::path dir(fs::complete("libtorrent_logs" + boost::lexical_cast<std::string>(instance)));
|
||||
if (!fs::exists(dir)) fs::create_directories(dir);
|
||||
m_file.open((dir / filename).string().c_str(), std::ios_base::out | (append ? std::ios_base::app : std::ios_base::out));
|
||||
*this << "\n\n\n*** starting log ***\n";
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
std::cerr << "failed to create log '" << filename << "': " << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
|
Loading…
Reference in New Issue