SDL Library
Embed:
(wiki syntax)
Show/hide line numbers
SDL_filesystem.h
Go to the documentation of this file.
00001 /* 00002 Simple DirectMedia Layer 00003 Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> 00004 00005 This software is provided 'as-is', without any express or implied 00006 warranty. In no event will the authors be held liable for any damages 00007 arising from the use of this software. 00008 00009 Permission is granted to anyone to use this software for any purpose, 00010 including commercial applications, and to alter it and redistribute it 00011 freely, subject to the following restrictions: 00012 00013 1. The origin of this software must not be misrepresented; you must not 00014 claim that you wrote the original software. If you use this software 00015 in a product, an acknowledgment in the product documentation would be 00016 appreciated but is not required. 00017 2. Altered source versions must be plainly marked as such, and must not be 00018 misrepresented as being the original software. 00019 3. This notice may not be removed or altered from any source distribution. 00020 */ 00021 00022 /** 00023 * \file SDL_filesystem.h 00024 * 00025 * \brief Include file for filesystem SDL API functions 00026 */ 00027 00028 #ifndef _SDL_filesystem_h 00029 #define _SDL_filesystem_h 00030 00031 #include "SDL_stdinc.h" 00032 00033 #include "begin_code.h" 00034 00035 /* Set up for C function definitions, even when using C++ */ 00036 #ifdef __cplusplus 00037 extern "C" { 00038 #endif 00039 00040 /** 00041 * \brief Get the path where the application resides. 00042 * 00043 * Get the "base path". This is the directory where the application was run 00044 * from, which is probably the installation directory, and may or may not 00045 * be the process's current working directory. 00046 * 00047 * This returns an absolute path in UTF-8 encoding, and is guaranteed to 00048 * end with a path separator ('\\' on Windows, '/' most other places). 00049 * 00050 * The pointer returned by this function is owned by you. Please call 00051 * SDL_free() on the pointer when you are done with it, or it will be a 00052 * memory leak. This is not necessarily a fast call, though, so you should 00053 * call this once near startup and save the string if you need it. 00054 * 00055 * Some platforms can't determine the application's path, and on other 00056 * platforms, this might be meaningless. In such cases, this function will 00057 * return NULL. 00058 * 00059 * \return String of base dir in UTF-8 encoding, or NULL on error. 00060 * 00061 * \sa SDL_GetPrefPath 00062 */ 00063 extern DECLSPEC char *SDLCALL SDL_GetBasePath(void); 00064 00065 /** 00066 * \brief Get the user-and-app-specific path where files can be written. 00067 * 00068 * Get the "pref dir". This is meant to be where users can write personal 00069 * files (preferences and save games, etc) that are specific to your 00070 * application. This directory is unique per user, per application. 00071 * 00072 * This function will decide the appropriate location in the native filesystem, 00073 * create the directory if necessary, and return a string of the absolute 00074 * path to the directory in UTF-8 encoding. 00075 * 00076 * On Windows, the string might look like: 00077 * "C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\" 00078 * 00079 * On Linux, the string might look like: 00080 * "/home/bob/.local/share/My Program Name/" 00081 * 00082 * On Mac OS X, the string might look like: 00083 * "/Users/bob/Library/Application Support/My Program Name/" 00084 * 00085 * (etc.) 00086 * 00087 * You specify the name of your organization (if it's not a real organization, 00088 * your name or an Internet domain you own might do) and the name of your 00089 * application. These should be untranslated proper names. 00090 * 00091 * Both the org and app strings may become part of a directory name, so 00092 * please follow these rules: 00093 * 00094 * - Try to use the same org string (including case-sensitivity) for 00095 * all your applications that use this function. 00096 * - Always use a unique app string for each one, and make sure it never 00097 * changes for an app once you've decided on it. 00098 * - Unicode characters are legal, as long as it's UTF-8 encoded, but... 00099 * - ...only use letters, numbers, and spaces. Avoid punctuation like 00100 * "Game Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient. 00101 * 00102 * This returns an absolute path in UTF-8 encoding, and is guaranteed to 00103 * end with a path separator ('\\' on Windows, '/' most other places). 00104 * 00105 * The pointer returned by this function is owned by you. Please call 00106 * SDL_free() on the pointer when you are done with it, or it will be a 00107 * memory leak. This is not necessarily a fast call, though, so you should 00108 * call this once near startup and save the string if you need it. 00109 * 00110 * You should assume the path returned by this function is the only safe 00111 * place to write files (and that SDL_GetBasePath(), while it might be 00112 * writable, or even the parent of the returned path, aren't where you 00113 * should be writing things). 00114 * 00115 * Some platforms can't determine the pref path, and on other 00116 * platforms, this might be meaningless. In such cases, this function will 00117 * return NULL. 00118 * 00119 * \param org The name of your organization. 00120 * \param app The name of your application. 00121 * \return UTF-8 string of user dir in platform-dependent notation. NULL 00122 * if there's a problem (creating directory failed, etc). 00123 * 00124 * \sa SDL_GetBasePath 00125 */ 00126 extern DECLSPEC char *SDLCALL SDL_GetPrefPath(const char *org, const char *app); 00127 00128 /* Ends C function definitions when using C++ */ 00129 #ifdef __cplusplus 00130 } 00131 #endif 00132 #include "close_code.h" 00133 00134 #endif /* _SDL_system_h */ 00135 00136 /* vi: set ts=4 sw=4 expandtab: */
Generated on Tue Jul 12 2022 15:10:18 by 1.7.2