关闭

boost::filesystem::exists()用法

805人阅读 评论(0) 收藏 举报
分类:
struct tm *newtime;
char tmpbuf[128];
time_t lt1;
time(&lt1);
newtime = localtime(&lt1);
strftime(tmpbuf, 128, "%Y%m%d", newtime);
std::string path1 = tmpbuf;
namespace fs = boost::filesystem;
fs::directory_iterator end_iter;
std::string path2 = WebApp::instance().conf().get("root.webserver.stockurl", "");
app.logger().log("dir url : [%s] ", path2);
bool hashist = true;
std::string path = util::path_append(path2, path1);
app.logger().log("file url :[%s] ", path);
fPortfolioName = path;
bool direxst = false;
direxst = boost::filesystem::exists(path2);
if (path2 == "")
{
hashist = false;
app.logger().log("config is null!!!");
app.logger().log("please add your config!!!");
}
if (direxst == false)
{
hashist = false;
}
else if (hashist == true)
{
for (fs::directory_iterator iter(path2); iter != end_iter; ++iter)
{
if (fs::is_regular_file(iter->status()))
{
date_["Date"][iter->path().filename().string()]["name"] = iter->path().filename().string();
app.logger().log("per file url :[%s] ", iter->path().filename().string());
}
}
}
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:42138次
    • 积分:961
    • 等级:
    • 排名:千里之外
    • 原创:55篇
    • 转载:2篇
    • 译文:0篇
    • 评论:5条
    最新评论