include/SDL_filesystem.h
changeset 7667 be1cc6f55840
child 7696 e605ca133ac6
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/include/SDL_filesystem.h	Tue Aug 20 19:57:11 2013 -0400
     1.3 @@ -0,0 +1,136 @@
     1.4 +/*
     1.5 +  Simple DirectMedia Layer
     1.6 +  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
     1.7 +
     1.8 +  This software is provided 'as-is', without any express or implied
     1.9 +  warranty.  In no event will the authors be held liable for any damages
    1.10 +  arising from the use of this software.
    1.11 +
    1.12 +  Permission is granted to anyone to use this software for any purpose,
    1.13 +  including commercial applications, and to alter it and redistribute it
    1.14 +  freely, subject to the following restrictions:
    1.15 +
    1.16 +  1. The origin of this software must not be misrepresented; you must not
    1.17 +     claim that you wrote the original software. If you use this software
    1.18 +     in a product, an acknowledgment in the product documentation would be
    1.19 +     appreciated but is not required.
    1.20 +  2. Altered source versions must be plainly marked as such, and must not be
    1.21 +     misrepresented as being the original software.
    1.22 +  3. This notice may not be removed or altered from any source distribution.
    1.23 +*/
    1.24 +
    1.25 +/**
    1.26 + *  \file SDL_filesystem.h
    1.27 + *
    1.28 + *  \brief Include file for filesystem SDL API functions
    1.29 + */
    1.30 +
    1.31 +#ifndef _SDL_filesystem_h
    1.32 +#define _SDL_filesystem_h
    1.33 +
    1.34 +#include "SDL_stdinc.h"
    1.35 +
    1.36 +#include "begin_code.h"
    1.37 +
    1.38 +/* Set up for C function definitions, even when using C++ */
    1.39 +#ifdef __cplusplus
    1.40 +extern "C" {
    1.41 +#endif
    1.42 +
    1.43 +/**
    1.44 + * \brief Get the path where the application resides.
    1.45 + *
    1.46 + * Get the "base path". This is the directory where the application was run
    1.47 + *  from, which is probably the installation directory, and may or may not
    1.48 + *  be the process's current working directory.
    1.49 + *
    1.50 + * This returns an absolute path in UTF-8 encoding, and is guaranteed to
    1.51 + *  end with a path separator ('\\' on Windows, '/' most other places).
    1.52 + *
    1.53 + * The pointer returned by this function is owned by you. Please call
    1.54 + *  SDL_free() on the pointer when you are done with it, or it will be a
    1.55 + *  memory leak. This is not necessarily a fast call, though, so you should
    1.56 + *  call this once near startup and save the string if you need it.
    1.57 + *
    1.58 + * Some platforms can't determine the application's path, and on other
    1.59 + *  platforms, this might be meaningless. In such cases, this function will
    1.60 + *  return NULL.
    1.61 + *
    1.62 + *  \return String of base dir in UTF-8 encoding, or NULL on error.
    1.63 + *
    1.64 + * \sa SDL_GetPrefPath
    1.65 + */
    1.66 +extern DECLSPEC char *SDLCALL SDL_GetBasePath(void);
    1.67 +
    1.68 +/**
    1.69 + * \brief Get the user-and-app-specific path where files can be written.
    1.70 + *
    1.71 + * Get the "pref dir". This is meant to be where users can write personal
    1.72 + *  files (preferences and save games, etc) that are specific to your
    1.73 + *  application. This directory is unique per user, per application.
    1.74 + *
    1.75 + * This function will decide the appropriate location in the native filesystem,
    1.76 + *  create the directory if necessary, and return a string of the absolute
    1.77 + *  path to the directory in UTF-8 encoding.
    1.78 + *
    1.79 + * On Windows, the string might look like:
    1.80 + *  "C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name"
    1.81 + *
    1.82 + * On Linux, the string might look like:
    1.83 + *  "/home/bob/.local/share/My Program Name"
    1.84 + *
    1.85 + * On Mac OS X, the string might look like:
    1.86 + *  "/Users/bob/Library/Application Support/My Program Name"
    1.87 + *
    1.88 + * (etc.)
    1.89 + *
    1.90 + * You specify the name of your organization (if it's not a real organization,
    1.91 + *  your name or an Internet domain you own might do) and the name of your
    1.92 + *  application. These should be untranslated proper names.
    1.93 + *
    1.94 + * Both the org and app strings may become part of a directory name, so
    1.95 + *  please follow these rules:
    1.96 + *
    1.97 + *    - Try to use the same org string (including case-sensitivity) for
    1.98 + *      all your applications that use this function.
    1.99 + *    - Always use a unique app string for each one, and make sure it never
   1.100 + *      changes for an app once you've decided on it.
   1.101 + *    - Unicode characters are legal, as long as it's UTF-8 encoded, but...
   1.102 + *    - ...only use letters, numbers, and spaces. Avoid punctuation like
   1.103 + *      "Game Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient.
   1.104 + *
   1.105 + * This returns an absolute path in UTF-8 encoding, and is guaranteed to
   1.106 + *  end with a path separator ('\\' on Windows, '/' most other places).
   1.107 + *
   1.108 + * The pointer returned by this function is owned by you. Please call
   1.109 + *  SDL_free() on the pointer when you are done with it, or it will be a
   1.110 + *  memory leak. This is not necessarily a fast call, though, so you should
   1.111 + *  call this once near startup and save the string if you need it.
   1.112 + *
   1.113 + * You should assume the path returned by this function is the only safe
   1.114 + *  place to write files (and that SDL_GetBasePath(), while it might be
   1.115 + *  writable, or even the parent of the returned path, aren't where you
   1.116 + *  should be writing things).
   1.117 + *
   1.118 + * Some platforms can't determine the pref path, and on other
   1.119 + *  platforms, this might be meaningless. In such cases, this function will
   1.120 + *  return NULL.
   1.121 + *
   1.122 + *   \param org The name of your organization.
   1.123 + *   \param app The name of your application.
   1.124 + *  \return UTF-8 string of user dir in platform-dependent notation. NULL
   1.125 + *          if there's a problem (creating directory failed, etc).
   1.126 + *
   1.127 + * \sa SDL_GetBasePath
   1.128 + */
   1.129 +extern DECLSPEC char *SDLCALL SDL_GetPrefPath(const char *org, const char *app);
   1.130 +
   1.131 +/* Ends C function definitions when using C++ */
   1.132 +#ifdef __cplusplus
   1.133 +}
   1.134 +#endif
   1.135 +#include "close_code.h"
   1.136 +
   1.137 +#endif /* _SDL_system_h */
   1.138 +
   1.139 +/* vi: set ts=4 sw=4 expandtab: */