void fcFileOpener::AddSearchPath(const std::string& path) { std::string p ( path ); normalize_path( p ); if ( IsPathExist( p ) ) { return; } _searchPath.push_back( p ); }
static int lua_isPathExist(lua_State* L) { int top = 0; const char* path = 0; top = lua_gettop(L); jn2Exit0(top == 1); path = lua_tostring(L, 1); jn2Exit0(path); lua_pushboolean(L, IsPathExist(path)); return 1; Exit0: return 0; }
bool CreateMultiDir(const TCHAR* lpDir) { if (!lpDir || *lpDir == '\0') return false; if (IsPathExist(lpDir)) return true; if (!CreateDirectory(lpDir, NULL)) { WCHAR szParentDir[MAX_PATH] = { 0 }; _tcscpy_s(szParentDir, MAX_PATH, lpDir); TCHAR * pEnd = strrchrm(szParentDir, _T("/\\")); if (!pEnd) return false; *pEnd = _T('\0'); CreateMultiDir(szParentDir); CreateDirectory(lpDir, NULL); } return true; }
static BOOL IsFileExists( const char* lpszFileName ) { return IsPathExist( lpszFileName ) == TRUE && IsDirectory( lpszFileName ) == FALSE; }