truly empty? in filesystem_ext
This commit is contained in:
parent
ff279652bc
commit
d335f34a6c
@ -112,7 +112,7 @@ namespace nana { namespace experimental { namespace filesystem
|
|||||||
public:
|
public:
|
||||||
#if defined(NANA_WINDOWS)
|
#if defined(NANA_WINDOWS)
|
||||||
using value_type = wchar_t;
|
using value_type = wchar_t;
|
||||||
const static value_type preferred_separator = '\\'; //? L'\\' ?
|
const static value_type preferred_separator = L'\\'; //? L'\\' ?
|
||||||
#else
|
#else
|
||||||
using value_type = char;
|
using value_type = char;
|
||||||
const static value_type preferred_separator = '/';
|
const static value_type preferred_separator = '/';
|
||||||
@ -151,10 +151,10 @@ namespace nana { namespace experimental { namespace filesystem
|
|||||||
//bool has_root_directory() const;
|
//bool has_root_directory() const;
|
||||||
//bool has_root_path() const;
|
//bool has_root_path() const;
|
||||||
//bool has_relative_path() const;
|
//bool has_relative_path() const;
|
||||||
bool has_parent_path() const { return !parent_path().empty(); }; // temp;;
|
bool has_parent_path() const { return !parent_path().string().empty(); }; // temp;;
|
||||||
bool has_filename() const { return !filename().empty(); }; // temp;
|
bool has_filename() const { return !filename().string().empty(); }; // temp;
|
||||||
//bool has_stem() const;
|
//bool has_stem() const;
|
||||||
bool has_extension() const { return !extension().empty(); }; // temp
|
bool has_extension() const { return !extension().string().empty(); }; // temp
|
||||||
//bool is_absolute() const;
|
//bool is_absolute() const;
|
||||||
//bool is_relative() const;
|
//bool is_relative() const;
|
||||||
|
|
||||||
|
@ -110,6 +110,7 @@ namespace nana { namespace experimental { namespace filesystem
|
|||||||
return pathstr_.compare(p.pathstr_);
|
return pathstr_.compare(p.pathstr_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// true if the path is empty, false otherwise. ??
|
||||||
bool path::empty() const noexcept
|
bool path::empty() const noexcept
|
||||||
{
|
{
|
||||||
#if defined(NANA_WINDOWS)
|
#if defined(NANA_WINDOWS)
|
||||||
@ -122,17 +123,20 @@ namespace nana { namespace experimental { namespace filesystem
|
|||||||
|
|
||||||
path path::extension() const
|
path path::extension() const
|
||||||
{
|
{
|
||||||
|
// todo: make more globlal
|
||||||
#if defined(NANA_WINDOWS)
|
#if defined(NANA_WINDOWS)
|
||||||
auto pos = pathstr_.find_last_of(L"\\/.");
|
auto SLorP=L"\\/.";
|
||||||
|
auto P=L'.';
|
||||||
#else
|
#else
|
||||||
auto pos = pathstr_.find_last_of("\\/.");
|
auto SLorP="\\/.";
|
||||||
|
auto P='.';
|
||||||
#endif
|
#endif
|
||||||
if ((pos == pathstr_.npos) || (pathstr_[pos] != '.'))
|
auto pos = pathstr_.find_last_of(SLorP);
|
||||||
return path();
|
|
||||||
|
|
||||||
|
if ( ( pos == pathstr_.npos)
|
||||||
if (pos + 1 == pathstr_.size())
|
|| ( pathstr_[pos] != P )
|
||||||
return path();
|
|| ( pos + 1 == pathstr_.size() ))
|
||||||
|
return path();
|
||||||
|
|
||||||
return path(pathstr_.substr(pos));
|
return path(pathstr_.substr(pos));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user