use std::filesystem instead of std::experimental::filesystem
This commit is contained in:
parent
186b76e765
commit
fb7a16bc61
@ -175,7 +175,7 @@ namespace nana { namespace experimental { namespace filesystem
|
|||||||
unknown = 0xFFFF ///< not known, such as when a file_status object is created without specifying the permissions
|
unknown = 0xFFFF ///< not known, such as when a file_status object is created without specifying the permissions
|
||||||
};
|
};
|
||||||
//enum class copy_options;
|
//enum class copy_options;
|
||||||
|
|
||||||
enum class directory_options
|
enum class directory_options
|
||||||
{
|
{
|
||||||
none,
|
none,
|
||||||
@ -538,13 +538,20 @@ namespace std {
|
|||||||
namespace filesystem {
|
namespace filesystem {
|
||||||
using namespace std::experimental::filesystem;
|
using namespace std::experimental::filesystem;
|
||||||
|
|
||||||
#if (defined(_MSC_VER) && ((!defined(_MSVC_LANG)) || (_MSVC_LANG < 201703)))
|
#if defined(NANA_FILESYSTEM_FORCE) || \
|
||||||
|
(defined(_MSC_VER) && ((!defined(_MSVC_LANG)) || (_MSVC_LANG < 201703)))
|
||||||
path absolute(const path& p);
|
path absolute(const path& p);
|
||||||
path absolute(const path& p, std::error_code& err);
|
path absolute(const path& p, std::error_code& err);
|
||||||
|
|
||||||
path canonical(const path& p);
|
path canonical(const path& p);
|
||||||
path canonical(const path& p, std::error_code& err);
|
path canonical(const path& p, std::error_code& err);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(NANA_FILESYSTEM_FORCE) || defined(NANA_MINGW)
|
||||||
|
bool exists( std::filesystem::file_status s ) noexcept;
|
||||||
|
bool exists( const std::filesystem::path& p );
|
||||||
|
bool exists( const std::filesystem::path& p, std::error_code& ec ) noexcept;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
} // std
|
} // std
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ namespace nana{ namespace paint{
|
|||||||
public:
|
public:
|
||||||
using graph_reference = nana::paint::graphics&;
|
using graph_reference = nana::paint::graphics&;
|
||||||
virtual ~image_impl_interface() = 0; //The destructor is defined in ../image.cpp
|
virtual ~image_impl_interface() = 0; //The destructor is defined in ../image.cpp
|
||||||
virtual bool open(const std::experimental::filesystem::path& file) = 0;
|
virtual bool open(const std::filesystem::path& file) = 0;
|
||||||
virtual bool open(const void* data, std::size_t bytes) = 0; // reads image from memory
|
virtual bool open(const void* data, std::size_t bytes) = 0; // reads image from memory
|
||||||
virtual bool alpha_channel() const = 0;
|
virtual bool alpha_channel() const = 0;
|
||||||
virtual bool empty() const = 0;
|
virtual bool empty() const = 0;
|
||||||
|
@ -33,7 +33,7 @@ namespace nana
|
|||||||
{
|
{
|
||||||
friend class graphics;
|
friend class graphics;
|
||||||
public:
|
public:
|
||||||
using path_type = ::std::experimental::filesystem::path;
|
using path_type = ::std::filesystem::path;
|
||||||
|
|
||||||
using font_style = ::nana::detail::font_style;
|
using font_style = ::nana::detail::font_style;
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ namespace nana
|
|||||||
: public font_interface
|
: public font_interface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using path_type = std::experimental::filesystem::path;
|
using path_type = std::filesystem::path;
|
||||||
|
|
||||||
internal_font(const path_type& ttf, const std::string& font_family, double font_size, const font_style& fs, native_font_type native_font):
|
internal_font(const path_type& ttf, const std::string& font_family, double font_size, const font_style& fs, native_font_type native_font):
|
||||||
ttf_(ttf),
|
ttf_(ttf),
|
||||||
|
@ -28,7 +28,7 @@ namespace nana
|
|||||||
public:
|
public:
|
||||||
using font = font_interface;
|
using font = font_interface;
|
||||||
|
|
||||||
using path_type = ::std::experimental::filesystem::path;
|
using path_type = ::std::filesystem::path;
|
||||||
|
|
||||||
static void initialize();
|
static void initialize();
|
||||||
/// Shutdown before destruction of platform_spec
|
/// Shutdown before destruction of platform_spec
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#include <nana/c++defines.hpp>
|
||||||
|
#if defined(NANA_POSIX) && defined(NANA_X11)
|
||||||
#include "theme.hpp"
|
#include "theme.hpp"
|
||||||
#include <nana/filesystem/filesystem.hpp>
|
#include <nana/filesystem/filesystem.hpp>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -295,4 +297,5 @@ namespace nana
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
@ -116,7 +116,7 @@ namespace nana
|
|||||||
//Windows stores file times using the FILETIME structure, which is a 64 bit value of 100ns intervals from January 1, 1601.
|
//Windows stores file times using the FILETIME structure, which is a 64 bit value of 100ns intervals from January 1, 1601.
|
||||||
//What's worse is that this 1601 date is fairly common to see given that it's the all zeroes value, and it is far before the
|
//What's worse is that this 1601 date is fairly common to see given that it's the all zeroes value, and it is far before the
|
||||||
//earliest date representable with time_t.std::filesystem can't change the reality of the underlying platform.
|
//earliest date representable with time_t.std::filesystem can't change the reality of the underlying platform.
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
#if NANA_USING_BOOST_FILESYSTEM
|
#if NANA_USING_BOOST_FILESYSTEM
|
||||||
@ -275,7 +275,7 @@ namespace nana { namespace experimental { namespace filesystem
|
|||||||
return has_root_directory();
|
return has_root_directory();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool path::is_relative() const
|
bool path::is_relative() const
|
||||||
{
|
{
|
||||||
return !is_absolute();
|
return !is_absolute();
|
||||||
@ -310,7 +310,7 @@ namespace nana { namespace experimental { namespace filesystem
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
path path::root_name() const
|
path path::root_name() const
|
||||||
{
|
{
|
||||||
@ -1123,11 +1123,12 @@ namespace nana { namespace experimental { namespace filesystem
|
|||||||
} //end namespace experimental
|
} //end namespace experimental
|
||||||
}//end namespace nana
|
}//end namespace nana
|
||||||
|
|
||||||
#if (defined(_MSC_VER) && ((!defined(_MSVC_LANG)) || (_MSVC_LANG < 201703)))
|
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
namespace filesystem
|
namespace filesystem
|
||||||
{
|
{
|
||||||
|
#if defined(NANA_FILESYSTEM_FORCE) || \
|
||||||
|
(defined(_MSC_VER) && ((!defined(_MSVC_LANG)) || (_MSVC_LANG < 201703)))
|
||||||
path absolute(const path& p)
|
path absolute(const path& p)
|
||||||
{
|
{
|
||||||
if (p.empty())
|
if (p.empty())
|
||||||
@ -1236,9 +1237,26 @@ namespace std
|
|||||||
{
|
{
|
||||||
return canonical(p, &err);
|
return canonical(p, &err);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(NANA_FILESYSTEM_FORCE) || defined(NANA_MINGW)
|
||||||
|
bool exists( std::filesystem::file_status s ) noexcept
|
||||||
|
{
|
||||||
|
return s.type() != file_type::not_found;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool exists( const std::filesystem::path& p )
|
||||||
|
{
|
||||||
|
return exists(status(p));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool exists( const std::filesystem::path& p, std::error_code& ec ) noexcept
|
||||||
|
{
|
||||||
|
return exists(status(p, ec));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}//end namespace filesystem
|
}//end namespace filesystem
|
||||||
}//end namespace std
|
}//end namespace std
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
#ifdef NANA_WINDOWS
|
#ifdef NANA_WINDOWS
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
@ -179,7 +180,7 @@ namespace nana
|
|||||||
win32com_drop_target(bool simple_mode):
|
win32com_drop_target(bool simple_mode):
|
||||||
simple_mode_(simple_mode)
|
simple_mode_(simple_mode)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Implements IUnknown
|
//Implements IUnknown
|
||||||
@ -279,7 +280,7 @@ namespace nana
|
|||||||
//Drop the object if left button is released.
|
//Drop the object if left button is released.
|
||||||
if (0 == (key_state & (MK_LBUTTON)))
|
if (0 == (key_state & (MK_LBUTTON)))
|
||||||
return DRAGDROP_S_DROP;
|
return DRAGDROP_S_DROP;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -468,7 +469,7 @@ namespace nana
|
|||||||
auto entry = find(*request_format, true);
|
auto entry = find(*request_format, true);
|
||||||
if (entry)
|
if (entry)
|
||||||
return _m_copy_medium(pmedium, &entry->medium, &entry->format);
|
return _m_copy_medium(pmedium, &entry->medium, &entry->format);
|
||||||
|
|
||||||
return DV_E_FORMATETC;
|
return DV_E_FORMATETC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,10 +482,10 @@ namespace nana
|
|||||||
{
|
{
|
||||||
if (NULL == pformatetc)
|
if (NULL == pformatetc)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
if (!(DVASPECT_CONTENT & pformatetc->dwAspect))
|
if (!(DVASPECT_CONTENT & pformatetc->dwAspect))
|
||||||
return DV_E_DVASPECT;
|
return DV_E_DVASPECT;
|
||||||
|
|
||||||
HRESULT result = DV_E_TYMED;
|
HRESULT result = DV_E_TYMED;
|
||||||
|
|
||||||
for (auto & entry : entries_)
|
for (auto & entry : entries_)
|
||||||
@ -563,7 +564,7 @@ namespace nana
|
|||||||
{
|
{
|
||||||
if (!(stgmed_dst && stgmed_src && fmt_src))
|
if (!(stgmed_dst && stgmed_src && fmt_src))
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
switch (stgmed_src->tymed)
|
switch (stgmed_src->tymed)
|
||||||
{
|
{
|
||||||
case TYMED_HGLOBAL:
|
case TYMED_HGLOBAL:
|
||||||
@ -646,7 +647,7 @@ namespace nana
|
|||||||
{
|
{
|
||||||
++ref_count_;
|
++ref_count_;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t release() override
|
std::size_t release() override
|
||||||
{
|
{
|
||||||
std::size_t val = --ref_count_;
|
std::size_t val = --ref_count_;
|
||||||
@ -768,7 +769,7 @@ namespace nana
|
|||||||
auto& atombase = _m_spec().atombase();
|
auto& atombase = _m_spec().atombase();
|
||||||
|
|
||||||
auto ddrop = dynamic_cast<dragdrop_target*>(i->second);
|
auto ddrop = dynamic_cast<dragdrop_target*>(i->second);
|
||||||
|
|
||||||
auto const native_source = reinterpret_cast<Window>(API::root(drag_wd));
|
auto const native_source = reinterpret_cast<Window>(API::root(drag_wd));
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -780,7 +781,7 @@ namespace nana
|
|||||||
hovered_.window_handle = nullptr;
|
hovered_.window_handle = nullptr;
|
||||||
hovered_.native_wd = 0;
|
hovered_.native_wd = 0;
|
||||||
window target_wd = 0;
|
window target_wd = 0;
|
||||||
|
|
||||||
if(ddrop->simple_mode())
|
if(ddrop->simple_mode())
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -816,7 +817,7 @@ namespace nana
|
|||||||
{
|
{
|
||||||
hovered_.window_handle = cur_wd;
|
hovered_.window_handle = cur_wd;
|
||||||
|
|
||||||
icon = (((drag_wd == cur_wd) || ddrop->has(drag_wd, cur_wd)) ? "dnd-move" : "dnd-none");
|
icon = (((drag_wd == cur_wd) || ddrop->has(drag_wd, cur_wd)) ? "dnd-move" : "dnd-none");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -855,9 +856,9 @@ namespace nana
|
|||||||
if(icon)
|
if(icon)
|
||||||
{
|
{
|
||||||
_m_free_cursor();
|
_m_free_cursor();
|
||||||
hovered_.cursor = ::XcursorFilenameLoadCursor(disp, icons_.cursor(icon).c_str());
|
hovered_.cursor = ::XcursorFilenameLoadCursor(disp, icons_.cursor(icon).c_str());
|
||||||
::XDefineCursor(disp, native_cur_wd, hovered_.cursor);
|
::XDefineCursor(disp, native_cur_wd, hovered_.cursor);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if(msg_pkt.u.xevent.type == ButtonRelease)
|
else if(msg_pkt.u.xevent.type == ButtonRelease)
|
||||||
@ -868,7 +869,7 @@ namespace nana
|
|||||||
API::release_capture(drag_wd);
|
API::release_capture(drag_wd);
|
||||||
return detail::propagation_chain::exit;
|
return detail::propagation_chain::exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return detail::propagation_chain::stop;
|
return detail::propagation_chain::stop;
|
||||||
});
|
});
|
||||||
@ -909,7 +910,7 @@ namespace nana
|
|||||||
{
|
{
|
||||||
std::cout<<"ButtonRelease"<<std::endl;
|
std::cout<<"ButtonRelease"<<std::endl;
|
||||||
API::release_capture(drag_wd);
|
API::release_capture(drag_wd);
|
||||||
|
|
||||||
xdnd_proto.mouse_release();
|
xdnd_proto.mouse_release();
|
||||||
std::cout<<"mouse_release"<<std::endl;
|
std::cout<<"mouse_release"<<std::endl;
|
||||||
target_wd = API::find_window(API::cursor_position());
|
target_wd = API::find_window(API::cursor_position());
|
||||||
@ -1166,7 +1167,7 @@ namespace nana
|
|||||||
drop_finished(has_dropped);
|
drop_finished(has_dropped);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
dragdrop::dragdrop(window source) :
|
dragdrop::dragdrop(window source) :
|
||||||
impl_(new implementation(source))
|
impl_(new implementation(source))
|
||||||
{
|
{
|
||||||
@ -1228,7 +1229,7 @@ namespace nana
|
|||||||
}
|
}
|
||||||
delete impl_;
|
delete impl_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dragdrop::condition(std::function<bool()> predicate_fn)
|
void dragdrop::condition(std::function<bool()> predicate_fn)
|
||||||
{
|
{
|
||||||
impl_->predicate = predicate_fn;
|
impl_->predicate = predicate_fn;
|
||||||
@ -1277,4 +1278,4 @@ namespace nana
|
|||||||
{
|
{
|
||||||
real_data_->files.emplace_back(std::move(path));
|
real_data_->files.emplace_back(std::move(path));
|
||||||
}
|
}
|
||||||
}//end namespace nana
|
}//end namespace nana
|
||||||
|
@ -111,11 +111,11 @@ namespace nana{ namespace paint
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool open(const std::experimental::filesystem::path& filename) override
|
bool open(const std::filesystem::path& filename) override
|
||||||
{
|
{
|
||||||
std::ifstream ifs(filename.string(), std::ios::binary);
|
std::ifstream ifs(filename.string(), std::ios::binary);
|
||||||
|
|
||||||
auto const bytes = static_cast<unsigned>(std::experimental::filesystem::file_size(filename));
|
auto const bytes = static_cast<unsigned>(std::filesystem::file_size(filename));
|
||||||
if (ifs && (bytes > static_cast<int>(sizeof(bitmap_file_header))))
|
if (ifs && (bytes > static_cast<int>(sizeof(bitmap_file_header))))
|
||||||
{
|
{
|
||||||
std::unique_ptr<char[]> buffer{ new char[bytes] };
|
std::unique_ptr<char[]> buffer{ new char[bytes] };
|
||||||
|
@ -241,7 +241,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool open(const std::experimental::filesystem::path& ico_file) override
|
bool open(const std::filesystem::path& ico_file) override
|
||||||
{
|
{
|
||||||
std::ifstream file(ico_file.string(), std::ios::binary);
|
std::ifstream file(ico_file.string(), std::ios::binary);
|
||||||
if (!file.is_open()) return false;
|
if (!file.is_open()) return false;
|
||||||
@ -290,7 +290,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
std::experimental::filesystem::path path_;
|
std::filesystem::path path_;
|
||||||
#if defined(NANA_WINDOWS)
|
#if defined(NANA_WINDOWS)
|
||||||
void* native_handle_{nullptr};
|
void* native_handle_{nullptr};
|
||||||
#endif
|
#endif
|
||||||
|
@ -29,7 +29,7 @@ namespace nana{ namespace paint
|
|||||||
:public image::image_impl_interface
|
:public image::image_impl_interface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool open(const std::experimental::filesystem::path& filename) override
|
bool open(const std::filesystem::path& filename) override
|
||||||
{
|
{
|
||||||
#if defined(NANA_WINDOWS)
|
#if defined(NANA_WINDOWS)
|
||||||
SHFILEINFO sfi;
|
SHFILEINFO sfi;
|
||||||
|
@ -47,7 +47,7 @@ namespace nana
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
bool open(const std::experimental::filesystem::path& jpeg_file) override
|
bool open(const std::filesystem::path& jpeg_file) override
|
||||||
{
|
{
|
||||||
auto fp = ::fopen(to_osmbstr(to_utf8(jpeg_file.native())).c_str(), "rb");
|
auto fp = ::fopen(to_osmbstr(to_utf8(jpeg_file.native())).c_str(), "rb");
|
||||||
if(nullptr == fp) return false;
|
if(nullptr == fp) return false;
|
||||||
|
@ -123,7 +123,7 @@ namespace nana
|
|||||||
delete[] row_ptrs;
|
delete[] row_ptrs;
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
bool open(const std::experimental::filesystem::path& png_file) override
|
bool open(const std::filesystem::path& png_file) override
|
||||||
{
|
{
|
||||||
auto fp = ::fopen(to_osmbstr(to_utf8(png_file.native())).c_str(), "rb");
|
auto fp = ::fopen(to_osmbstr(to_utf8(png_file.native())).c_str(), "rb");
|
||||||
if(nullptr == fp) return false;
|
if(nullptr == fp) return false;
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#include "detail/image_ico_resource.hpp"
|
#include "detail/image_ico_resource.hpp"
|
||||||
#include "detail/image_ico.hpp"
|
#include "detail/image_ico.hpp"
|
||||||
|
|
||||||
namespace fs = std::experimental::filesystem;
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
namespace nana
|
namespace nana
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,7 @@ namespace nana
|
|||||||
std::uint16_t string_offset; //from start of storage area
|
std::uint16_t string_offset; //from start of storage area
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
using path_type = ::std::experimental::filesystem::path;
|
using path_type = ::std::filesystem::path;
|
||||||
|
|
||||||
truetype(const path_type& filename)
|
truetype(const path_type& filename)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user