-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate_file.c
More file actions
39 lines (37 loc) · 1.38 KB
/
Copy pathvalidate_file.c
File metadata and controls
39 lines (37 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* validate_file.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dbarba-v <dbarba-v@student.42madrid.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/12/02 19:28:49 by dbarba-v #+# #+# */
/* Updated: 2026/01/18 22:36:38 by dbarba-v ### ########.fr */
/* */
/* ************************************************************************** */
#include "cub3d.h"
#include "errors.h"
#include "parse.h"
#include <stdlib.h>
/**
* @brief Validates scene file extension and access
*
* @param filepath
* @return int SUCCESS OR FAILURE
*/
int validate_file(char *filepath)
{
if (!filepath)
{
return (EXIT_FAILURE);
}
if (validate_extension(filepath, SCENE_EXTENSION) == EXIT_FAILURE)
{
return (error_extension(SCENE_EXTENSION));
}
if (validate_fileaccess(filepath) == EXIT_FAILURE)
{
return (perror_generic(filepath));
}
return (EXIT_SUCCESS);
}