Rev 1 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | pmbaty | 1 | /* |
2 | Simple DirectMedia Layer |
||
8 | pmbaty | 3 | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
1 | pmbaty | 4 | |
5 | This software is provided 'as-is', without any express or implied |
||
6 | warranty. In no event will the authors be held liable for any damages |
||
7 | arising from the use of this software. |
||
8 | |||
9 | Permission is granted to anyone to use this software for any purpose, |
||
10 | including commercial applications, and to alter it and redistribute it |
||
11 | freely, subject to the following restrictions: |
||
12 | |||
13 | 1. The origin of this software must not be misrepresented; you must not |
||
14 | claim that you wrote the original software. If you use this software |
||
15 | in a product, an acknowledgment in the product documentation would be |
||
16 | appreciated but is not required. |
||
17 | 2. Altered source versions must be plainly marked as such, and must not be |
||
18 | misrepresented as being the original software. |
||
19 | 3. This notice may not be removed or altered from any source distribution. |
||
20 | */ |
||
21 | |||
22 | /** |
||
23 | * \file SDL_filesystem.h |
||
24 | * |
||
25 | * \brief Include file for filesystem SDL API functions |
||
26 | */ |
||
27 | |||
28 | #ifndef SDL_filesystem_h_ |
||
29 | #define SDL_filesystem_h_ |
||
30 | |||
31 | #include "SDL_stdinc.h" |
||
32 | |||
33 | #include "begin_code.h" |
||
34 | |||
35 | /* Set up for C function definitions, even when using C++ */ |
||
36 | #ifdef __cplusplus |
||
37 | extern "C" { |
||
38 | #endif |
||
39 | |||
40 | /** |
||
41 | * \brief Get the path where the application resides. |
||
42 | * |
||
43 | * Get the "base path". This is the directory where the application was run |
||
44 | * from, which is probably the installation directory, and may or may not |
||
45 | * be the process's current working directory. |
||
46 | * |
||
47 | * This returns an absolute path in UTF-8 encoding, and is guaranteed to |
||
48 | * end with a path separator ('\\' on Windows, '/' most other places). |
||
49 | * |
||
50 | * The pointer returned by this function is owned by you. Please call |
||
51 | * SDL_free() on the pointer when you are done with it, or it will be a |
||
52 | * memory leak. This is not necessarily a fast call, though, so you should |
||
53 | * call this once near startup and save the string if you need it. |
||
54 | * |
||
55 | * Some platforms can't determine the application's path, and on other |
||
56 | * platforms, this might be meaningless. In such cases, this function will |
||
57 | * return NULL. |
||
58 | * |
||
59 | * \return String of base dir in UTF-8 encoding, or NULL on error. |
||
60 | * |
||
61 | * \sa SDL_GetPrefPath |
||
62 | */ |
||
63 | extern DECLSPEC char *SDLCALL SDL_GetBasePath(void); |
||
64 | |||
65 | /** |
||
66 | * \brief Get the user-and-app-specific path where files can be written. |
||
67 | * |
||
68 | * Get the "pref dir". This is meant to be where users can write personal |
||
69 | * files (preferences and save games, etc) that are specific to your |
||
70 | * application. This directory is unique per user, per application. |
||
71 | * |
||
72 | * This function will decide the appropriate location in the native filesystem, |
||
73 | * create the directory if necessary, and return a string of the absolute |
||
74 | * path to the directory in UTF-8 encoding. |
||
75 | * |
||
76 | * On Windows, the string might look like: |
||
77 | * "C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\" |
||
78 | * |
||
79 | * On Linux, the string might look like: |
||
80 | * "/home/bob/.local/share/My Program Name/" |
||
81 | * |
||
82 | * On Mac OS X, the string might look like: |
||
83 | * "/Users/bob/Library/Application Support/My Program Name/" |
||
84 | * |
||
85 | * (etc.) |
||
86 | * |
||
87 | * You specify the name of your organization (if it's not a real organization, |
||
88 | * your name or an Internet domain you own might do) and the name of your |
||
89 | * application. These should be untranslated proper names. |
||
90 | * |
||
91 | * Both the org and app strings may become part of a directory name, so |
||
92 | * please follow these rules: |
||
93 | * |
||
94 | * - Try to use the same org string (including case-sensitivity) for |
||
95 | * all your applications that use this function. |
||
96 | * - Always use a unique app string for each one, and make sure it never |
||
97 | * changes for an app once you've decided on it. |
||
98 | * - Unicode characters are legal, as long as it's UTF-8 encoded, but... |
||
99 | * - ...only use letters, numbers, and spaces. Avoid punctuation like |
||
100 | * "Game Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient. |
||
101 | * |
||
102 | * This returns an absolute path in UTF-8 encoding, and is guaranteed to |
||
103 | * end with a path separator ('\\' on Windows, '/' most other places). |
||
104 | * |
||
105 | * The pointer returned by this function is owned by you. Please call |
||
106 | * SDL_free() on the pointer when you are done with it, or it will be a |
||
107 | * memory leak. This is not necessarily a fast call, though, so you should |
||
108 | * call this once near startup and save the string if you need it. |
||
109 | * |
||
110 | * You should assume the path returned by this function is the only safe |
||
111 | * place to write files (and that SDL_GetBasePath(), while it might be |
||
112 | * writable, or even the parent of the returned path, aren't where you |
||
113 | * should be writing things). |
||
114 | * |
||
115 | * Some platforms can't determine the pref path, and on other |
||
116 | * platforms, this might be meaningless. In such cases, this function will |
||
117 | * return NULL. |
||
118 | * |
||
119 | * \param org The name of your organization. |
||
120 | * \param app The name of your application. |
||
121 | * \return UTF-8 string of user dir in platform-dependent notation. NULL |
||
122 | * if there's a problem (creating directory failed, etc). |
||
123 | * |
||
124 | * \sa SDL_GetBasePath |
||
125 | */ |
||
126 | extern DECLSPEC char *SDLCALL SDL_GetPrefPath(const char *org, const char *app); |
||
127 | |||
128 | /* Ends C function definitions when using C++ */ |
||
129 | #ifdef __cplusplus |
||
130 | } |
||
131 | #endif |
||
132 | #include "close_code.h" |
||
133 | |||
134 | #endif /* SDL_filesystem_h_ */ |
||
135 | |||
136 | /* vi: set ts=4 sw=4 expandtab: */ |