diff --git a/.travis.yml b/.travis.yml index 08c3d6f0..7b71b9ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/include/nana/filesystem/filesystem.hpp b/include/nana/filesystem/filesystem.hpp index f14c043f..beaa1545 100644 --- a/include/nana/filesystem/filesystem.hpp +++ b/include/nana/filesystem/filesystem.hpp @@ -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 diff --git a/source/filesystem/filesystem.cpp b/source/filesystem/filesystem.cpp index b13e8465..061a12f7 100644 --- a/source/filesystem/filesystem.cpp +++ b/source/filesystem/filesystem.cpp @@ -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(); diff --git a/source/gui/filebox.cpp b/source/gui/filebox.cpp index 5b2db9e2..aff5b2a7 100644 --- a/source/gui/filebox.cpp +++ b/source/gui/filebox.cpp @@ -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}) {}