Skip to content
This repository has been archived by the owner on Nov 2, 2023. It is now read-only.

Commit

Permalink
Remove pre-created folders. Will be made on launch.
Browse files Browse the repository at this point in the history
  • Loading branch information
brian8544 committed Jun 9, 2023
1 parent aa35add commit 065bb8f
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .gitignore
@@ -1,5 +1,5 @@
# Ignore image comparison
/contrib/images


## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
Expand Down
10 changes: 0 additions & 10 deletions RealTimeFacialRecognition.vcxproj
Expand Up @@ -147,11 +147,6 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<None Include="contrib\images\.placeholder">
<DeploymentContent>true</DeploymentContent>
<Link>/images/.placeholder</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Text Include="contrib\testing\group.mp4">
<DeploymentContent>true</DeploymentContent>
<Link>/testing/group.mp4</Link>
Expand All @@ -163,11 +158,6 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<DeploymentContent>true</DeploymentContent>
</Text>
<Text Include="contrib\logs\system.log">
<Link>/logs/system.log</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<DeploymentContent>true</DeploymentContent>
</Text>
</ItemGroup>
<ItemGroup>
<Xml Include="contrib\cascades\haarcascade_frontalface_alt2.xml">
Expand Down
2 changes: 1 addition & 1 deletion build.bat
Expand Up @@ -24,7 +24,7 @@ echo binPath is set to: %binPath%

:: Delete unnecessary files from the release folder.
echo --- Some errors may show up, depending on which build mode has been used. Don't worry ---
::del /s /q "%binPath%*.log"
del /s /q "%binPath%*.log"
del /s /q "%binPath%*.pdb"
del /s /q "%binPath%*.obj"
del /s /q "%binPath%*.idb"
Expand Down
36 changes: 36 additions & 0 deletions src/Main.cpp
Expand Up @@ -14,6 +14,40 @@ std::string CASCADE_FILE_MAIN;
std::string IMAGE_DIR;
std::string LOGGING_DIR;

void Initialize() {
if (std::filesystem::is_directory(LOGGING_DIR))
{
Messages::Info("Logging directory exists. Continuing.");
}
else
{
std::filesystem::create_directory(LOGGING_DIR);
Messages::Notice("Logging directory does not exist. It has been created. First launch?");
}

if (std::filesystem::is_directory(IMAGE_DIR))
{
Messages::Info("Image directory exists. Continuing.");
}
else
{
std::filesystem::create_directory(IMAGE_DIR);
Messages::Notice("Image directory does not exist. It has been created. First launch?");
}

if (!std::filesystem::exists(LOGGING_DIR + "/system.log")) {
std::ofstream logFile(LOGGING_DIR + "/system.log");
if (!logFile) {
Messages::Error("Log file could not be created. Check file permissions?");
}
logFile.close();
Messages::Notice("Log file created successfully. First launch?");
}
else {
Messages::Info("Log file exists, appending.");
}
}

// Function to check if a file has a valid image extension
bool hasValidImageExtension(const std::filesystem::path& path) {
std::string extension = path.extension().string();
Expand Down Expand Up @@ -185,6 +219,8 @@ int main(int argc, char** argv)
{
readSettings();

Initialize();

// Load the face cascade
cv::CascadeClassifier faceCascade(CASCADE_FILE_MAIN);

Expand Down

0 comments on commit 065bb8f

Please sign in to comment.