3 * \brief Get the path where the application resides.
5 * Get the "base path". This is the directory where the application was run
6 * from, which is probably the installation directory, and may or may not
7 * be the process's current working directory.
9 * This returns an absolute path in UTF-8 encoding, and is guaranteed to
10 * end with a path separator ('\\' on Windows, '/' most other places).
12 * The pointer returned by this function is owned by you. Please call
13 * SDL_free() on the pointer when you are done with it, or it will be a
14 * memory leak. This is not necessarily a fast call, though, so you should
15 * call this once near startup and save the string if you need it.
17 * Some platforms can't determine the application's path, and on other
18 * platforms, this might be meaningless. In such cases, this function will
21 * \return String of base dir in UTF-8 encoding, or NULL on error.
25 function SDL_GetBasePath(): PChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetBasePath' {$ENDIF} {$ENDIF};
28 * \brief Get the user-and-app-specific path where files can be written.
30 * Get the "pref dir". This is meant to be where users can write personal
31 * files (preferences and save games, etc) that are specific to your
32 * application. This directory is unique per user, per application.
34 * This function will decide the appropriate location in the native filesystem,
35 * create the directory if necessary, and return a string of the absolute
36 * path to the directory in UTF-8 encoding.
38 * On Windows, the string might look like:
39 * "C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\"
41 * On Linux, the string might look like:
42 * "/home/bob/.local/share/My Program Name/"
44 * On Mac OS X, the string might look like:
45 * "/Users/bob/Library/Application Support/My Program Name/"
49 * You specify the name of your organization (if it's not a real organization,
50 * your name or an Internet domain you own might do) and the name of your
51 * application. These should be untranslated proper names.
53 * Both the org and app strings may become part of a directory name, so
54 * please follow these rules:
56 * - Try to use the same org string (including case-sensitivity) for
57 * all your applications that use this function.
58 * - Always use a unique app string for each one, and make sure it never
59 * changes for an app once you've decided on it.
60 * - Unicode characters are legal, as long as it's UTF-8 encoded, but...
61 * - ...only use letters, numbers, and spaces. Avoid punctuation like
62 * "Game Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient.
64 * This returns an absolute path in UTF-8 encoding, and is guaranteed to
65 * end with a path separator ('\\' on Windows, '/' most other places).
67 * The pointer returned by this function is owned by you. Please call
68 * SDL_free() on the pointer when you are done with it, or it will be a
69 * memory leak. This is not necessarily a fast call, though, so you should
70 * call this once near startup and save the string if you need it.
72 * You should assume the path returned by this function is the only safe
73 * place to write files (and that SDL_GetBasePath(), while it might be
74 * writable, or even the parent of the returned path, aren't where you
75 * should be writing things).
77 * Some platforms can't determine the pref path, and on other
78 * platforms, this might be meaningless. In such cases, this function will
81 * \param org The name of your organization.
82 * \param app The name of your application.
83 * \return UTF-8 string of user dir in platform-dependent notation. NULL
84 * if there's a problem (creating directory failed, etc).
88 function SDL_GetPrefPath(const org: PAnsiChar; const app: PAnsiChar): PChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPrefPath' {$ENDIF} {$ENDIF};