Skip to content

Commit

Permalink
Correção
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrobiqua committed Dec 26, 2023
1 parent af1aa9a commit 63fb6ad
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ project(OpenCV_Learn)

set(CMAKE_CXX_STANDARD 17)

# include(CopyFiles.cmake)
# copy_files_to_destination()
include(CopyFiles.cmake)
copy_files_to_destination()

# Adiciona as flags de compilação
add_compile_options(-Wall -g -MMD)
Expand Down
3 changes: 3 additions & 0 deletions CopyFiles.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function(copy_files_to_destination)

# Caminho completo para o arquivo config.ini dentro de .visualisador-rostos
set(CONFIG_FILE "${HIDDEN_FOLDER_PATH}/config.ini")
set(IMAGE_FILE "${HIDDEN_FOLDER_PATH}/id-do-rosto.ico")

# Verifica se a pasta oculta já existe
file(MAKE_DIRECTORY ${HIDDEN_FOLDER_PATH} EXIST_OK ERROR_VARIABLE MAKE_DIRECTORY_ERROR)
Expand All @@ -38,8 +39,10 @@ function(copy_files_to_destination)

# Copia o arquivo config.ini para o diretório desejado
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.ini "${CONFIG_FILE}" COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/id-do-rosto.ico "${IMAGE_FILE}" COPYONLY)

message(STATUS "Subpastas 'model' e 'img' copiadas para: ${HIDDEN_FOLDER_PATH}")
message(STATUS "Arquivo 'config.ini' copiado para: ${HIDDEN_FOLDER_PATH}")
message(STATUS "Arquivo 'id-do-rosto.ico' copiado para: ${HIDDEN_FOLDER_PATH}")
endif()
endfunction()
2 changes: 1 addition & 1 deletion gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void MainWindow::draw_widgets() {
set_title("Leitor de rostos");
set_default_size(300, 400);

const std::string icon_path = "../id-do-rosto.ico";
const std::string icon_path = FolderManagment::get_image_ico();
set_icon_from_file(icon_path);

// Fixed
Expand Down
4 changes: 2 additions & 2 deletions options/ReaderFacesInFolder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ namespace ReaderFacesFolder {
int maxHeight = 1200;

// Paths
string folder_img_path = "../";
string classifier_path = "../model/";
string folder_img_path = FolderManagment::get_img_folder();
string classifier_path = FolderManagment::get_model_folder() + "/";

if (readConfig["Images"]["Folder_path"].find('/') == 0) {
// Pegando pela raiz do cliente
Expand Down
5 changes: 5 additions & 0 deletions util/FolderManagment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ std::string FolderManagment::get_config_file() {
return home_folder + "/config.ini";
}

std::string FolderManagment::get_image_ico() {
auto home_folder = get_home_folder();
return home_folder + "/id-do-rosto.ico";
}

std::string FolderManagment::get_home_folder() {
std::string homeDir = getenv("HOME");

Expand Down
1 change: 1 addition & 0 deletions util/FolderManagment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class FolderManagment {
static std::string get_model_folder();
static std::string get_img_folder();
static std::string get_config_file();
static std::string get_image_ico();
static std::string get_home_folder();
};

Expand Down

0 comments on commit 63fb6ad

Please sign in to comment.