Merge branch 'boostfix' of https://github.com/pavelxdd/nana into pavelxdd-boostfix

This commit is contained in:
Jinhao
2017-12-01 22:18:13 +08:00
7 changed files with 57 additions and 19 deletions

View File

@@ -14,7 +14,13 @@
#include <nana/filesystem/filesystem_ext.hpp>
#include <vector>
#include <sstream>
#include <iomanip> //put_time
#include <nana/config.hpp>
#ifdef _enable_std_put_time
#include <nana/stdc++.hpp>
#else
#include <iomanip>
#endif
#if defined(NANA_WINDOWS)
#include <windows.h>
@@ -97,7 +103,13 @@ namespace nana
std::string pretty_file_date(const fs::path& path) // todo: move to .cpp
{
try {
#if NANA_USING_BOOST_FILESYSTEM
// The return type of boost::filesystem::last_write_time isn't
// the same as in nana and std implementations of this function
auto ftime = std::chrono::system_clock::from_time_t(fs::last_write_time(path));
#else
auto ftime = fs::last_write_time(path);
#endif
// crash: VS2015 will not read the time for some files (for example: C:/hiberfil.sys)
// and will return file_time_type(-1) without throwing

View File

@@ -505,21 +505,18 @@ namespace nana
auto fpath = i->path().native();
auto fattr = fs::status(fpath);
auto ftype = static_cast<fs::file_type>(fattr.type());
item_fs m;
m.name = name;
m.directory = fs::is_directory(fattr);
switch(fattr.type())
{
case fs::file_type::not_found:
case fs::file_type::unknown:
case fs::file_type::directory:
if (ftype == fs::file_type::not_found ||
ftype == fs::file_type::unknown ||
ftype == fs::file_type::directory)
m.bytes = 0;
break;
default:
else
m.bytes = fs::file_size(fpath);
}
fs_ext::modified_file_time(fpath, m.modified_time);
@@ -692,13 +689,12 @@ namespace nana
return;
}
using file_type = fs::file_type;
fs::path fspath(fb_.addr_.filesystem + path);
auto fst = fs::status(fspath);
auto fattr = fs::status(fspath);
auto ftype = static_cast<fs::file_type>(fattr.type());
if(fst.type() != file_type::not_found && fst.type() != file_type::none)
if(ftype != fs::file_type::not_found && ftype != fs::file_type::none)
{
mb<<i18n("NANA_FILEBOX_ERROR_RENAME_FOLDER_BECAUSE_OF_EXISTING");
mb();
@@ -800,6 +796,7 @@ namespace nana
tar = addr_.filesystem + file;
auto fattr = fs::status(tar);
auto ftype = static_cast<fs::file_type>(fattr.type());
//Check if the selected name is a directory
auto is_dir = fs::is_directory(fattr);
@@ -808,6 +805,7 @@ namespace nana
{
//Add the extension, then check if it is a directory again.
fattr = fs::status(tar);
ftype = static_cast<fs::file_type>(fattr.type());
is_dir = fs::is_directory(fattr);
}
@@ -820,7 +818,7 @@ namespace nana
if(io_read_)
{
if(fs::file_type::not_found == fattr.type())
if(fs::file_type::not_found == ftype)
{
msgbox mb(*this, caption());
mb.icon(msgbox::icon_information);
@@ -832,7 +830,7 @@ namespace nana
}
else
{
if(fs::file_type::not_found != fattr.type())
if(fs::file_type::not_found != ftype)
{
msgbox mb(*this, caption(), msgbox::yes_no);
mb.icon(msgbox::icon_question);

View File

@@ -15,7 +15,12 @@
#include <nana/gui/detail/bedrock.hpp>
#include <nana/std_thread.hpp>
#include <iostream>
#include <chrono>
#ifdef STD_THREAD_NOT_SUPPORTED
# include <boost/chrono.hpp>
#else
# include <chrono>
#endif
//#define NANA_AUTOMATIC_GUI_TESTING
namespace nana