RetroArch
file_path.h
Go to the documentation of this file.
1 /* Copyright (C) 2010-2018 The RetroArch team
2  *
3  * ---------------------------------------------------------------------------------------
4  * The following license statement only applies to this file (file_path.h).
5  * ---------------------------------------------------------------------------------------
6  *
7  * Permission is hereby granted, free of charge,
8  * to any person obtaining a copy of this software and associated documentation files (the "Software"),
9  * to deal in the Software without restriction, including without limitation the rights to
10  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
11  * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
16  * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  */
22 
23 #ifndef __LIBRETRO_SDK_FILE_PATH_H
24 #define __LIBRETRO_SDK_FILE_PATH_H
25 
26 #include <stdio.h>
27 #include <stdint.h>
28 #include <stddef.h>
29 #include <sys/types.h>
30 
31 #include <retro_common_api.h>
32 
33 #include <boolean.h>
34 
36 
37 /* Order in this enum is equivalent to negative sort order in filelist
38  * (i.e. DIRECTORY is on top of PLAIN_FILE) */
39 enum
40 {
47 };
48 
49 
58 bool path_is_compressed_file(const char *path);
59 
74 #define path_contains_compressed_file(path) (path_get_archive_delim((path)) != NULL)
75 
86 const char *path_get_archive_delim(const char *path);
87 
97 const char *path_get_extension(const char *path);
98 
113 char *path_remove_extension(char *path);
114 
123 const char *path_basename(const char *path);
124 
132 void path_basedir(char *path);
133 
141 void path_parent_dir(char *path);
142 
151 void path_resolve_realpath(char *buf, size_t size);
152 
161 bool path_is_absolute(const char *path);
162 
184 void fill_pathname(char *out_path, const char *in_path,
185  const char *replace, size_t size);
186 
199 void fill_dated_filename(char *out_filename,
200  const char *ext, size_t size);
201 
215 void fill_str_dated_filename(char *out_filename,
216  const char *in_str, const char *ext, size_t size);
217 
232 void fill_pathname_noext(char *out_path, const char *in_path,
233  const char *replace, size_t size);
234 
243 char *find_last_slash(const char *str);
244 
262 void fill_pathname_dir(char *in_dir, const char *in_basename,
263  const char *replace, size_t size);
264 
273 void fill_pathname_base(char *out_path, const char *in_path, size_t size);
274 
275 void fill_pathname_base_noext(char *out_dir,
276  const char *in_path, size_t size);
277 
278 void fill_pathname_base_ext(char *out,
279  const char *in_path, const char *ext,
280  size_t size);
281 
292 void fill_pathname_basedir(char *out_path, const char *in_path, size_t size);
293 
294 void fill_pathname_basedir_noext(char *out_dir,
295  const char *in_path, size_t size);
296 
307 bool fill_pathname_parent_dir_name(char *out_dir,
308  const char *in_dir, size_t size);
309 
319 void fill_pathname_parent_dir(char *out_dir,
320  const char *in_dir, size_t size);
321 
334 void fill_pathname_resolve_relative(char *out_path, const char *in_refpath,
335  const char *in_path, size_t size);
336 
348 void fill_pathname_join(char *out_path, const char *dir,
349  const char *path, size_t size);
350 
351 void fill_pathname_join_special_ext(char *out_path,
352  const char *dir, const char *path,
353  const char *last, const char *ext,
354  size_t size);
355 
357  char *out_path,
358  const char *dir, const char *path,
359  const char *concat,
360  size_t size);
361 
362 void fill_pathname_join_concat(char *out_path,
363  const char *dir, const char *path,
364  const char *concat,
365  size_t size);
366 
367 void fill_pathname_join_noext(char *out_path,
368  const char *dir, const char *path, size_t size);
369 
381 void fill_pathname_join_delim(char *out_path, const char *dir,
382  const char *path, const char delim, size_t size);
383 
384 void fill_pathname_join_delim_concat(char *out_path, const char *dir,
385  const char *path, const char delim, const char *concat,
386  size_t size);
387 
403 void fill_short_pathname_representation(char* out_rep,
404  const char *in_path, size_t size);
405 
407  const char *in_path, size_t size);
408 
409 void fill_pathname_expand_special(char *out_path,
410  const char *in_path, size_t size);
411 
412 void fill_pathname_abbreviate_special(char *out_path,
413  const char *in_path, size_t size);
414 
422 void path_basedir_wrapper(char *path);
423 
432 #ifdef _WIN32
433 #define path_char_is_slash(c) (((c) == '/') || ((c) == '\\'))
434 #else
435 #define path_char_is_slash(c) ((c) == '/')
436 #endif
437 
445 #ifdef _WIN32
446 #define path_default_slash() "\\"
447 #define path_default_slash_c() '\\'
448 #else
449 #define path_default_slash() "/"
450 #define path_default_slash_c() '/'
451 #endif
452 
461 void fill_pathname_slash(char *path, size_t size);
462 
463 #if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL)
464 void fill_pathname_application_path(char *buf, size_t size);
465 void fill_pathname_application_dir(char *buf, size_t size);
466 void fill_pathname_home_dir(char *buf, size_t size);
467 #endif
468 
477 bool path_mkdir(const char *dir);
478 
487 bool path_is_directory(const char *path);
488 
489 bool path_is_character_special(const char *path);
490 
491 bool path_is_valid(const char *path);
492 
493 int32_t path_get_size(const char *path);
494 
496 
497 #endif
void fill_pathname_resolve_relative(char *out_path, const char *in_refpath, const char *in_path, size_t size)
Definition: file_path.c:864
void fill_pathname_basedir_noext(char *out_dir, const char *in_path, size_t size)
Definition: file_path.c:626
void fill_pathname_join_concat(char *out_path, const char *dir, const char *path, const char *concat, size_t size)
Definition: file_path.c:923
void fill_short_pathname_representation(char *out_rep, const char *in_path, size_t size)
Definition: file_path.c:990
bool path_mkdir(const char *dir)
Definition: file_path.c:276
const char * path_get_archive_delim(const char *path)
Definition: file_path.c:364
void path_parent_dir(char *path)
Definition: file_path.c:762
void fill_pathname_join_concat_noext(char *out_path, const char *dir, const char *path, const char *concat, size_t size)
Definition: file_path.c:913
bool path_is_absolute(const char *path)
Definition: file_path.c:802
Definition: file_path.h:41
const char * path_basename(const char *path)
Definition: file_path.c:778
bool path_is_directory(const char *path)
Definition: file_path.c:233
void fill_pathname_slash(char *path, size_t size)
Definition: file_path.c:530
#define RETRO_BEGIN_DECLS
Definition: retro_common_api.h:41
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:8418
int32_t path_get_size(const char *path)
Definition: file_path.c:248
GLsizei const GLchar ** path
Definition: glext.h:7901
bool fill_pathname_parent_dir_name(char *out_dir, const char *in_dir, size_t size)
Definition: file_path.c:643
void fill_pathname_base(char *out_path, const char *in_path, size_t size)
Definition: file_path.c:585
bool path_is_valid(const char *path)
Definition: file_path.c:243
char * find_last_slash(const char *str)
Definition: file_path.c:509
GLsizeiptr size
Definition: glext.h:6559
void fill_pathname_expand_special(char *out_path, const char *in_path, size_t size)
Definition: file_path.c:1010
void fill_pathname_join_delim(char *out_path, const char *dir, const char *path, const char delim, size_t size)
Definition: file_path.c:951
void fill_dated_filename(char *out_filename, const char *ext, size_t size)
Definition: file_path.c:696
void fill_pathname_join(char *out_path, const char *dir, const char *path, size_t size)
Definition: file_path.c:888
struct passwd out
Definition: missing_libc_functions.c:51
void fill_str_dated_filename(char *out_filename, const char *in_str, const char *ext, size_t size)
Definition: file_path.c:719
void fill_pathname_join_delim_concat(char *out_path, const char *dir, const char *path, const char delim, const char *concat, size_t size)
Definition: file_path.c:967
char * path_remove_extension(char *path)
Definition: file_path.c:421
void fill_pathname_noext(char *out_path, const char *in_path, const char *replace, size_t size)
Definition: file_path.c:502
void fill_pathname_basedir(char *out_path, const char *in_path, size_t size)
Definition: file_path.c:618
void fill_pathname_parent_dir(char *out_dir, const char *in_dir, size_t size)
Definition: file_path.c:676
Definition: file_path.h:46
signed int int32_t
Definition: stdint.h:123
#define RETRO_END_DECLS
Definition: retro_common_api.h:42
void path_basedir_wrapper(char *path)
Definition: file_path.c:1152
void fill_pathname_join_special_ext(char *out_path, const char *dir, const char *path, const char *last, const char *ext, size_t size)
Definition: file_path.c:900
Definition: file_path.h:43
void fill_pathname(char *out_path, const char *in_path, const char *replace, size_t size)
Definition: file_path.c:473
Definition: file_path.h:42
Definition: file_path.h:44
const char * path_get_extension(const char *path)
Definition: file_path.c:398
void fill_pathname_join_noext(char *out_path, const char *dir, const char *path, size_t size)
Definition: file_path.c:932
bool path_is_compressed_file(const char *path)
Definition: file_path.c:440
bool path_is_character_special(const char *path)
Definition: file_path.c:238
void fill_pathname_base_noext(char *out_dir, const char *in_path, size_t size)
Definition: file_path.c:595
void fill_pathname_dir(char *in_dir, const char *in_basename, const char *replace, size_t size)
Definition: file_path.c:566
void fill_pathname_abbreviate_special(char *out_path, const char *in_path, size_t size)
Definition: file_path.c:1081
void path_resolve_realpath(char *buf, size_t size)
Definition: file_path.c:828
void fill_pathname_base_ext(char *out, const char *in_path, const char *ext, size_t size)
Definition: file_path.c:601
Definition: file_path.h:45
void fill_short_pathname_representation_noext(char *out_rep, const char *in_path, size_t size)
Definition: file_path.c:1003
const char *const str
Definition: portlistingparse.c:18
void path_basedir(char *path)
Definition: file_path.c:741