Merge branch 'folderbox_weakly_canonical' of https://github.com/qPCR4vir/nana into qPCR4vir-folderbox_weakly_canonical

This commit is contained in:
Jinhao 2019-03-21 22:30:16 +08:00
commit 71e3f9de80
4 changed files with 25 additions and 7 deletions

View File

@ -8,11 +8,11 @@ cache:
matrix:
include:
- env: CXX=g++-5 CC=gcc-5
- env: CXX=g++-8
addons:
apt:
packages:
- g++-5
- g++-8
- libjpeg8-dev
- libpng-dev
- libasound2-dev
@ -21,7 +21,7 @@ matrix:
- libx11-dev
- libxft-dev
- libxcursor-dev
sources:
sources:
- ubuntu-toolchain-r-test
allow_failures:
@ -44,7 +44,7 @@ matrix:
before_install:
- cd ..
- git clone --depth=1 --branch=cmake-dev https://github.com/qPCR4vir/nana-demo.git nana-demo
- git clone --depth=1 --branch=hotfix https://github.com/qPCR4vir/nana-demo.git nana-demo
- export PATH="$HOME/bin:$PATH"
#- mkdir ~/bin #it seemd that a bin already exists from 20170901

View File

@ -254,7 +254,7 @@ namespace nana { namespace experimental { namespace filesystem
path relative_path() const;
path parent_path() const;
path filename() const;
//path stem() const;
path stem() const;
path extension() const;
// query

View File

@ -225,8 +225,10 @@ namespace nana { namespace experimental { namespace filesystem
//Because of No wide character version of POSIX
#if defined(NANA_POSIX)
const char* separators = "/";
const char* punt = ".";
#else
const wchar_t* separators = L"/\\";
const wchar_t* punt = L".";
#endif
//class file_status
@ -453,6 +455,22 @@ namespace nana { namespace experimental { namespace filesystem
return{ pathstr_ };
}
path path::stem() const
{
auto pos = pathstr_.find_last_of(separators);
auto ext = pathstr_.find_last_of(punt);
if (pos == pathstr_.npos)
pos = 0;
else
pos++;
if (ext == pathstr_.npos || ext < pos)
return path(pathstr_.substr(pos));
else
return path(pathstr_.substr(pos, ext-pos));
}
void path::clear() noexcept
{
pathstr_.clear();

View File

@ -1359,7 +1359,7 @@ namespace nana
path.resize(len);
impl_->path = to_utf8(path);
}
}
#endif
}
@ -1589,7 +1589,7 @@ namespace nana
};
folderbox::folderbox(window owner, const path_type& init_path, std::string title)
: impl_(new implement{ owner, fs::canonical(init_path).make_preferred(), title, false})
: impl_(new implement{ owner, fs::weakly_canonical(init_path).make_preferred(), title, false})
{}