forked from shawwwn/H2OExtractor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
74 additions
and
25 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
/* FileUtils.cpp */ | ||
#include "FileUtils.h" | ||
|
||
PathType checkPathType(const char* dirPath) | ||
{ | ||
if (access(dirPath, 0)==0) | ||
namespace Util { namespace File { | ||
|
||
// Is the provided path a folder or a file | ||
PathType checkPathType(const char* dirPath) | ||
{ | ||
struct stat status; | ||
stat(dirPath, &status); | ||
if ( status.st_mode & S_IFDIR ) | ||
return TYPE_DIR; | ||
else | ||
return TYPE_FILE; | ||
if (access(dirPath, 0)==0) | ||
{ | ||
struct stat status; | ||
stat(dirPath, &status); | ||
if ( status.st_mode & S_IFDIR ) | ||
return TYPE_DIR; | ||
else | ||
return TYPE_FILE; | ||
} | ||
return TYPE_NOT_EXIST; | ||
} | ||
return TYPE_NOT_EXIST; | ||
} | ||
|
||
}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* GeneralUtils.hpp */ | ||
#pragma once | ||
#include <vector> | ||
|
||
#define SAFE_DELETE(a) if( (a) != NULL ) delete (a); (a) = NULL; | ||
#define SAFE_DELETE_ARRAY(a) if( (a) != NULL ) delete[] (a); (a) = NULL; | ||
|
||
namespace Util { namespace Gen { | ||
|
||
// Delete all the allocated arrays | ||
template<typename T> void clearVectorOfArray(std::vector<T>& vec) | ||
{ | ||
for ( int i = 0; i < vec.size(); i++ ) | ||
{ | ||
SAFE_DELETE_ARRAY(vec[i]); | ||
} | ||
vec.clear(); | ||
} | ||
|
||
// Delete all the allocated (single) contents | ||
template<typename T> void clearVectorOfContent(std::vector<T>& vec) | ||
{ | ||
for ( int i = 0; i < vec.size(); i++ ) | ||
{ | ||
SAFE_DELETE(vec[i]); | ||
} | ||
vec.clear(); | ||
} | ||
|
||
}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters