1canonicalize_filename(3) Allegro manual canonicalize_filename(3)
2
3
4
6 canonicalize_filename - Converts any filename into its canonical form.
7 Allegro game programming library.
8
10 #include <allegro.h>
11
12
13 char *canonicalize_filename(char *dest, const char *filename, int
14 size);
15
17 Converts any filename into its canonical form, i.e. the minimal abso‐
18 lute filename describing the same file and fixing incorrect for‐
19 ward/backward slashes for the current platform, storing at most `size'
20 bytes into the `dest' buffer. You can use the same buffer both as input
21 and output because Allegro internally works on a copy of the input
22 before touching `dest'. Example:
23
24 char buf[256];
25 ...
26 canonicalize_filename(buf, "~/../s22/..\\t3st///hi.c",
27 sizeof(buf));
28 /* Running this under Unix would
29 return: /home/t3st/hi.c */
30
31 Note that this function won't work as expected if the path to canoni‐
32 calize comes from another platform (eg. a "c:\something" path will
33 canonicalize into something really wrong under Unix: "/cur‐
34 rent/path/c:/something").
35
37 Returns a copy of the `dest' parameter.
38
39
41 fix_filename_case(3), fix_filename_slashes(3)
42
43
44
45Allegro version 4.4.3 canonicalize_filename(3)