lua_filehelpers.cpp: Add lua script function 'mkdir()'

- Set Lua api version to 1.52


Origin commit data
------------------
Branch: ni/coolstream
Commit: 906e9a2156
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2016-09-04 (Sun, 04 Sep 2016)



------------------
This commit was generated by Migit
This commit is contained in:
Michael Liebmann
2016-09-04 20:56:15 +02:00
parent ac62dcec55
commit 0bfd3c22d6
4 changed files with 54 additions and 2 deletions

View File

@@ -882,6 +882,8 @@ bool CFileHelpers::copyDir(const char *Src, const char *Dst, bool backupMode)
// false - errno is set
bool CFileHelpers::createDir(string& Dir, mode_t mode)
{
CFileHelpers* fh = CFileHelpers::getInstance();
fh->clearDebugInfo();
int res = 0;
for(string::iterator iter = Dir.begin() ; iter != Dir.end();) {
string::iterator newIter = find(iter, Dir.end(), '/' );
@@ -895,7 +897,12 @@ bool CFileHelpers::createDir(string& Dir, mode_t mode)
// We can assume that if an error
// occured, following will fail too,
// so break here.
dprintf(DEBUG_NORMAL, "[CFileHelpers %s] creating directory %s: %s\n", __func__, newPath.c_str(), strerror(errno));
if (!fh->getConsoleQuiet())
dprintf(DEBUG_NORMAL, "[CFileHelpers %s] creating directory %s: %s\n", __func__, newPath.c_str(), strerror(errno));
char buf[1024];
memset(buf, '\0', sizeof(buf));
snprintf(buf, sizeof(buf)-1, "creating directory %s: %s", newPath.c_str(), strerror(errno));
fh->setDebugInfo(buf, __path_file__, __func__, __LINE__);
break;
}
}