annotate th_file.h @ 722:4ca6a3b30fe8

Bump copyright years.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 02 Jan 2021 11:35:54 +0200
parents a6e7a29ecd30
children 29e44a58bc73
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
184
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /*
653
3c9205d52376 Doxygen fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 621
diff changeset
2 * File, directory, path etc. related helper functions
184
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 * Programmed and designed by Matti 'ccr' Hamalainen
722
4ca6a3b30fe8 Bump copyright years.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
4 * (C) Copyright 2016-2021 Tecnic Software productions (TNSP)
184
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 *
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 * Please read file 'COPYING' for information on license and distribution.
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 */
436
9148bc3fa838 Begin adding Doxygen documentation for some things. Very rudimentary, and
Matti Hamalainen <ccr@tnsp.org>
parents: 432
diff changeset
8 /// @file
653
3c9205d52376 Doxygen fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 621
diff changeset
9 /// @brief File, directory, path etc. related helper functions
184
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 #ifndef TH_FILE_H
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 #define TH_FILE_H
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12
621
badca3de39ea #include th_types.h instead of th_util.h
Matti Hamalainen <ccr@tnsp.org>
parents: 558
diff changeset
13 #include "th_types.h"
184
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14
459
7fca448847a3 Oops, fix C++ guards in headers.
Matti Hamalainen <ccr@tnsp.org>
parents: 457
diff changeset
15 #ifdef __cplusplus
7fca448847a3 Oops, fix C++ guards in headers.
Matti Hamalainen <ccr@tnsp.org>
parents: 457
diff changeset
16 extern "C" {
7fca448847a3 Oops, fix C++ guards in headers.
Matti Hamalainen <ccr@tnsp.org>
parents: 457
diff changeset
17 #endif
184
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 // Platform specific defines
558
7b7872212afd Use \ directory separator for DOS as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 557
diff changeset
20 #if defined(TH_PLAT_WINDOWS) || defined(TH_PLAT_DOS)
557
5c3697bfefa3 Rename TH_DIR_SEPARATOR define to TH_DIR_SEPARATOR_CHR and add new
Matti Hamalainen <ccr@tnsp.org>
parents: 553
diff changeset
21 # define TH_DIR_SEPARATOR_CHR '\\'
5c3697bfefa3 Rename TH_DIR_SEPARATOR define to TH_DIR_SEPARATOR_CHR and add new
Matti Hamalainen <ccr@tnsp.org>
parents: 553
diff changeset
22 # define TH_DIR_SEPARATOR_STR "\\"
184
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 #else
557
5c3697bfefa3 Rename TH_DIR_SEPARATOR define to TH_DIR_SEPARATOR_CHR and add new
Matti Hamalainen <ccr@tnsp.org>
parents: 553
diff changeset
24 # define TH_DIR_SEPARATOR_CHR '/'
5c3697bfefa3 Rename TH_DIR_SEPARATOR define to TH_DIR_SEPARATOR_CHR and add new
Matti Hamalainen <ccr@tnsp.org>
parents: 553
diff changeset
25 # define TH_DIR_SEPARATOR_STR "/"
184
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26 #endif
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29 // Flags for th_stat_path()
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30 enum
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 {
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32 TH_IS_DIR = 0x1000,
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33 TH_IS_SYMLINK = 0x2000,
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 TH_IS_WRITABLE = 0x0002,
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 TH_IS_READABLE = 0x0004,
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37 };
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39
475
77d1af382e08 Improve th_stat_path() by changing flags into a struct and adding more information.
Matti Hamalainen <ccr@tnsp.org>
parents: 459
diff changeset
40 typedef struct
77d1af382e08 Improve th_stat_path() by changing flags into a struct and adding more information.
Matti Hamalainen <ccr@tnsp.org>
parents: 459
diff changeset
41 {
77d1af382e08 Improve th_stat_path() by changing flags into a struct and adding more information.
Matti Hamalainen <ccr@tnsp.org>
parents: 459
diff changeset
42 int flags;
478
b1e80180818a Improve th_stat_path() some more and fix Windows issues.
Matti Hamalainen <ccr@tnsp.org>
parents: 475
diff changeset
43 uint64_t size;
b1e80180818a Improve th_stat_path() some more and fix Windows issues.
Matti Hamalainen <ccr@tnsp.org>
parents: 475
diff changeset
44 uint64_t atime, mtime, ctime;
475
77d1af382e08 Improve th_stat_path() by changing flags into a struct and adding more information.
Matti Hamalainen <ccr@tnsp.org>
parents: 459
diff changeset
45 } th_stat_data;
77d1af382e08 Improve th_stat_path() by changing flags into a struct and adding more information.
Matti Hamalainen <ccr@tnsp.org>
parents: 459
diff changeset
46
77d1af382e08 Improve th_stat_path() by changing flags into a struct and adding more information.
Matti Hamalainen <ccr@tnsp.org>
parents: 459
diff changeset
47
653
3c9205d52376 Doxygen fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 621
diff changeset
48 char * th_get_home_dir(void);
207
75dbac8f2f59 Actually make th_get_config_dir() work.
Matti Hamalainen <ccr@tnsp.org>
parents: 201
diff changeset
49 char * th_get_config_dir(const char *name);
184
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50
475
77d1af382e08 Improve th_stat_path() by changing flags into a struct and adding more information.
Matti Hamalainen <ccr@tnsp.org>
parents: 459
diff changeset
51 BOOL th_stat_path(const char *path, th_stat_data *data);
684
a6e7a29ecd30 Constify.
Matti Hamalainen <ccr@tnsp.org>
parents: 653
diff changeset
52 BOOL th_mkdir_path(const char *path, const int mode);
184
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55 #ifdef __cplusplus
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56 }
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57 #endif
b256db93cf25 Initial import of th_file module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
58 #endif // TH_FILE_H