using explicit namespaces

This commit is contained in:
qPCR4vir
2016-06-24 14:22:04 +02:00
parent 2f86b26075
commit 3b6718d67f
5 changed files with 48 additions and 37 deletions

View File

@@ -30,6 +30,8 @@
#include <algorithm>
#endif
namespace fs = nana::experimental::filesystem;
namespace nana
{
#if defined(NANA_POSIX)
@@ -142,7 +144,7 @@ namespace nana
auto path = path_.caption();
auto root = path.substr(0, path.find('/'));
if(root == "HOME")
path.replace(0, 4, nana::experimental::filesystem::path_user().native());
path.replace(0, 4, fs::path_user().native());
else if(root == "FILESYSTEM")
path.erase(0, 10);
else
@@ -344,7 +346,7 @@ namespace nana
else
dir = saved_selected_path;
_m_load_cat_path(dir.size() ? dir : nana::experimental::filesystem::path_user().native());
_m_load_cat_path(dir.size() ? dir : fs::path_user().native());
tb_file_.caption(file_with_path_removed);
}
@@ -427,8 +429,6 @@ namespace nana
nodes_.filesystem = tree_.insert("FS.ROOT", "Filesystem");
nodes_.filesystem.value(kind::filesystem);
namespace fs = ::nana::experimental::filesystem;
std::vector<std::string> paths;
paths.emplace_back(fs::path_user().native());
paths.emplace_back("/");
@@ -474,7 +474,7 @@ namespace nana
{
auto begstr = path.substr(0, pos);
if(begstr == "FS.HOME")
path.replace(0, 7, nana::experimental::filesystem::path_user().native());
path.replace(0, 7, fs::path_user().native());
else
path.erase(0, pos);
return begstr;
@@ -490,8 +490,6 @@ namespace nana
file_container_.clear();
namespace fs = ::nana::experimental::filesystem;
fs::directory_iterator end;
for(fs::directory_iterator i(path); i != end; ++i)
{
@@ -508,13 +506,13 @@ namespace nana
{
m.bytes = fs::file_size(path + m.name);
m.directory = fs::is_directory(fattr);
::nana::experimental::filesystem::modified_file_time(path + m.name, m.modified_time);
fs::modified_file_time(path + m.name, m.modified_time);
}
else
{
m.bytes = 0;
m.directory = fs::is_directory(*i);
::nana::experimental::filesystem::modified_file_time(path + i->path().filename().native(), m.modified_time);
fs::modified_file_time(path + i->path().filename().native(), m.modified_time);
}
file_container_.push_back(m);
@@ -530,11 +528,13 @@ namespace nana
if((path.size() == 0) || (path[path.size() - 1] != '/'))
path += '/';
namespace fs = ::nana::experimental::filesystem;
auto beg_node = tree_.selected();
while(!beg_node.empty() && (beg_node != nodes_.home) && (beg_node != nodes_.filesystem))
beg_node = beg_node.owner();
auto head = nana::experimental::filesystem::path_user().native();
auto head = fs::path_user().native();
if(path.size() >= head.size() && (path.substr(0, head.size()) == head))
{//This is HOME
path_.caption("HOME");
@@ -552,7 +552,6 @@ namespace nana
if(head.size() == 0 || head[head.size() - 1] != '/')
head += '/';
namespace fs = ::nana::experimental::filesystem;
fs::directory_iterator end;
for(fs::directory_iterator i(head); i != end; ++i)
@@ -649,20 +648,20 @@ namespace nana
return;
}
using file_type = nana::experimental::filesystem::file_type;
using file_type = fs::file_type;
experimental::filesystem::path fspath(fb_.addr_.filesystem + path);
fs::path fspath(fb_.addr_.filesystem + path);
auto fs = experimental::filesystem::status(fspath);
auto fst = fs::status(fspath);
if(fs.type() != file_type::not_found && fs.type() != file_type::none)
if(fst.type() != file_type::not_found && fst.type() != file_type::none)
{
mb<<L"The folder is existing, please rename it.";
mb();
return;
}
if(false == experimental::filesystem::create_directory(fspath))
if(false == fs::create_directory(fspath))
{
mb<<L"Failed to create the folder, please rename it.";
mb();
@@ -756,7 +755,6 @@ namespace nana
bool good = true;
namespace fs = ::nana::experimental::filesystem;
auto fattr = fs::status(tar);
if(fattr.type() == fs::file_type::not_found)
{
@@ -809,8 +807,6 @@ namespace nana
auto path = tree_.make_key_path(node, "/") + "/";
_m_resolute_path(path);
namespace fs = ::nana::experimental::filesystem;
fs::directory_iterator end;
for (fs::directory_iterator i{path}; i != end; ++i)
{
@@ -952,7 +948,6 @@ namespace nana
}
else
{
namespace fs = ::nana::experimental::filesystem;
if (fs::is_directory(ipstr))
impl_->path = ipstr;
}