some modification about directory feature

pull/152/head
x86kernel 10 years ago
parent 99e79dd4f8
commit 7cf172d282

@ -51,8 +51,12 @@ public:
_filename = fname;
for (int tries = 0; tries < open_tries; ++tries)
{
if (os::dir_check(fname, dirs))
if(os::create_dirs(dirs))
return;
if (!os::fopen_s(&_fd, fname, mode))
return;
return ;
std::this_thread::sleep_for(std::chrono::milliseconds(open_interval));
}
@ -133,6 +137,7 @@ public:
private:
FILE* _fd;
std::list<std::string> dirs;
std::string _filename;
bool _force_flush;

@ -195,14 +195,6 @@ inline int fopen_s(FILE** fp, const std::string& filename, const char* mode)
*fp = _fsopen((filename.c_str()), mode, _SH_DENYWR);
return *fp == nullptr;
#else
std::list<std::string> dirs;
if(dir_check(filename, dirs))
{
if(create_dirs(dirs))
return true;
}
*fp = fopen((filename.c_str()), mode);
return *fp == nullptr;

Loading…
Cancel
Save