src/filesystem


Log

Author Commit Date CI Message
Sylvain Becker b458d7a2 2019-10-30T15:13:55 Readability: remove redundant cast to the same type
Sam Lantinga e954e32b 2019-07-18T19:33:17 Fixed bug 4726 - Fix for tvOS GetPrefPath Caleb Cornett Unlike iOS and macOS, tvOS does not have any persistent local storage. In fact, the ApplicationSupport directory pointed to by the existing Cocoa GetPrefPath() throws an error whenever any attempt is made to access it. To get any local storage on an Apple TV, our only option is to use a temporary cache directory. This patch changes the tvOS PrefPath to this cache directory and also logs a critical warning that this if developers want their save data to persist across game sessions, they must use some form of iCloud storage.
Sam Lantinga 5e13087b 2019-01-04T22:01:14 Updated copyright for 2019
sezero 40b27fd5 2018-02-12T17:00:00 revert the recent typecast assignment changes (see bug #4079) also change the void* typedefs for the two vulkan function pointers added in vulkan_internal.h into generic function pointer typedefs.
Sam Lantinga 90e72bf4 2018-01-30T18:08:34 Fixed ISO C99 compatibility SDL now builds with gcc 7.2 with the following command line options: -Wall -pedantic-errors -Wno-deprecated-declarations -Wno-overlength-strings --std=c99
Sam Lantinga e3cc5b2c 2018-01-03T10:03:25 Updated copyright for 2018
Ryan C. Gordon 00905c98 2017-08-17T03:22:44 filesystem: Patched to compile on QNX.
Ryan C. Gordon e50d3cdf 2017-08-17T02:58:46 filesystem: QNX should use SDL_LoadFile() instead of rolling it from scratch.
Ryan C. Gordon c13c45c7 2017-08-17T01:25:48 qnx: Implemented SDL_GetBasePath().
Sam Lantinga 658975f3 2017-08-11T11:32:00 Fixed bug 3639 - SDL_GetPrefPath returns a path with two consecutive slashes on Unix if org is omitted Fabian Greffrath we use SDL_GetPrefPath() in Chocolate Doom to get a reasonable directory to save and restore config files and savegames: https://github.com/chocolate-doom/chocolate-doom/blob/sdl2-branch/src/m_config.c#L2162 However, since there is no "organization" behind Chocolate Doom and there is really only one "product" called Chocolate Doom, we pass an empty string for the org parameter and the package string for app. This leads to two consecutive slashes in the path returned by SDL_GetPrefPath() like this: /home/user/.local/share//chocolate-doom/ While this is harmless, it sure looks bad. I believe that it should be possible to either pass a NULL pointer for the org parameter or at least have the function detect an empty string as a means to express "there is no origanization, just a single product". The generation of the path string to be returned by the function will have to get adapted accordingly.
Philipp Wiesemann 84aeab17 2017-07-29T23:00:14 haiku: Changed header paths to be more compatible.
Philipp Wiesemann 6086e8d3 2017-06-17T22:30:09 haiku: Fixed missing slash in path from SDL_GetPrefPath().
Philipp Wiesemann 52b7d0eb 2017-06-04T23:15:27 android: Fixed missing error message for SDL_GetBasePath().
Philipp Wiesemann 3639895e 2017-05-27T23:30:07 Removed unused errno includes.
Sam Lantinga 45b774e3 2017-01-01T18:33:28 Updated copyright for 2017
Philipp Wiesemann 51053a06 2016-08-30T21:14:13 Fixed compiling if filesystem is disabled (thanks, Elias!). Fixes Bugzilla #3414.
Sam Lantinga 4249f466 2016-01-31T21:11:15 David Carlier implemented SDL_GetBasePath() for OpenBSD
Sam Lantinga 42065e78 2016-01-02T10:10:34 Updated copyright to 2016
Philipp Wiesemann 0e45984f 2015-06-21T17:33:46 Fixed crash if initialization of EGL failed but was tried again later. The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly uninitialized data structure if loading the library first failed. A later try to use EGL then skipped initialization and assumed it was previously successful because the data structure now already existed. This led to at least one crash in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was dereferenced to make a call to eglBindAPI().
Ryan C. Gordon 4d1626d0 2015-05-28T15:36:27 Windows SDL_GetBasePath: free string on failure.
Ryan C. Gordon aa43bee4 2015-05-28T15:32:45 Windows GetBasePath: fixed reallocation code.
Ryan C. Gordon 566316e0 2015-05-28T15:29:43 Windows SDL_GetBasePath: Fixed wrong variable when growing the buffer size.
Sam Lantinga bccc2ad0 2015-05-28T12:06:48 Fixed compiling and tested on Windows
Ryan C. Gordon 6d1ad384 2015-05-28T01:54:52 Windows GetBasePath should use GetModuleFileNameExW() and check for overflows. Apparently you might get strange paths from GetModuleFileName(), such as short path names or UNC filenames, so this avoids that problem. Since you have to tapdance with linking different libraries and defining macros depending on what Windows you plan to target, we dynamically load the API we need, which works on all versions of Windows (on Win7, it'll load a compatibility wrapper for the newer API location). What a mess. This also now does the right thing if there isn't enough space to store the path, looping with a larger allocated buffer each try. Fixes Bugzilla #2435.
Sam Lantinga 2c4a6ea0 2015-05-26T06:27:46 Updated the copyright year to 2015
Ryan C. Gordon b72938c8 2015-04-20T12:22:44 Windows: Always set the system timer resolution to 1ms by default. An existing hint lets apps that don't need the timer resolution changed avoid this, to save battery, etc, but this fixes several problems in timing, audio callbacks not firing fast enough, etc. Fixes Bugzilla #2944.
Philipp Wiesemann 86fb92a7 2015-04-15T21:25:15 Emscripten: Fixed memory leak if SDL_GetPrefPath() failed.
Alex Szpakowski fe6c797c 2015-04-10T23:30:31 Fixed an iOS view orientation issue when SDL_GL_CreateContext or SDL_CreateRenderer is called.
Alex Szpakowski df98b11c 2015-04-06T15:26:37 Merged default into iOS-improvements
Edward Rudd b88ca1b4 2015-02-10T16:28:56 the last parameter of XChangeProperty is the number of elements.. and when the element format is 32.. the element is "long" so we have 5 long elements here. Yes this seems confusing as on mac+linux Long is either 32 or 64bits depending on the architecture, but this is how the X11 protocol is defined. Thus 5 is the correct value for the nelts here. Not 5 or 10 depending on the architecture. More info on the confusion https://bugs.freedesktop.org/show_bug.cgi?id=16802
Philipp Wiesemann 43500a78 2015-01-31T21:06:37 Fixed comment in implementation for NaCl.
Philipp Wiesemann b48e54aa 2015-01-26T22:00:29 Fixed bug 2802 - [patch] Fix android build compiling in wrong filesystem implementation Jonas Kulla The configure script didn't differentiate between Linux and Android, unconditionally compiling in the unix implementation of SDL_sysfilesystem.c. I'm probably one of the very few people building SDL for android using classic configure + standalone toolchain, so this has gone undetected all along.
Alex Szpakowski ea5d1a8a 2015-01-15T01:15:24 Merged default into iOS-improvements
Ryan C. Gordon fe40a172 2014-12-18T00:19:52 Initial merge of Emscripten port! With this commit, you can compile SDL2 with Emscripten ( http://emscripten.org/ ), and make your SDL-based C/C++ program into a web app. This port was due to the efforts of several people, including: Charlie Birks, Sathyanarayanan Gunasekaran, Jukka Jyl?nki, Alon Zakai, Edward Rudd, Bruce Mitchener, and Martin Gerhardy. (Thanks, everyone!)
David Ludwig 70438be2 2014-12-03T10:55:23 WinRT: fixed bug whereby SDL would override an app's default orientation WinRT apps can set a default, preferred orientation via a .appxmanifest file. SDL was overriding this on app startup, and making the app use all possible orientations (landscape and portrait). Thanks to Eric Wing for the heads up on this!
David Ludwig 5fee84f2 2014-12-02T21:18:50 WinRT: removed SDL_HINT_WINRT_PREF_PATH_ROOT (introduced post-2.0.3 & pre-2.0.4) A WinRT app's Roaming folder-path can still be retrieved via calls to SDL_WinRTGetFSPathUTF8() or SDL_WinRTGetFSPathUNICODE(), if need be.
Alex Szpakowski cc0631a0 2014-12-02T02:52:45 Merged default into iOS-improvements
David Ludwig ce64b4ad 2014-11-29T10:09:30 WinRT: bug and data-integrity fixes for SDL_GetPrefPath() This change does a few things, all with regards to the WinRT implementation of SDL_GetPrefPath(): 1. it fixes a bug whereby SDL_GetPrefPath() did not create the directory it returned. On other SDL platforms, SDL_GetPrefPath() will create separate directories for its 'org' and 'app' folders. Without this, attempts to create files in the pref-path would fail, unless those directories were first created by the app, or by some other library the app used. This change makes sure that these directories get created, before SDL_GetPrefPath() returns to its caller(s). 2. it defaults to having SDL_GetPrefPath() return a WinRT 'Local' folder on all platforms. Previously, for Windows Store apps, it would have used a different, 'Roaming' folder. Files in Roaming folders can be automatically, and synchronized across multiple devices by Windows. This synchronization can happen while the app runs, with new files being copied into a running app's pref-path. Unless an app is specifically designed to handle this scenario, there is a chance that save-data could be overwritten in unwanted or unexpected ways. The default is now to use a Local folder, which does not get synchronized, and which is arguably a bit safer to use. Apps that wish to use Roaming folders can do so by setting SDL_HINT_WINRT_PREF_PATH_ROOT to "roaming", however it is recommended that one first read Microsoft's documentation for Roaming files, a link to which is provided in README-winrt.md. To preserve older pref-path selection behavior (found in SDL 2.0.3, as well as many pre-2.0.4 versions of SDL from hg.libsdl.org), which uses a Roaming path in Windows Store apps, and a Local path in Windows Phone, set SDL_HINT_WINRT_PREF_PATH_ROOT to "old". Please note that Roaming paths are not supported on Windows Phone 8.0, due to limitations in the OS itself. Attempts to use this will fail. (Windows Phone 8.1 does not have this limitation, however.) 3. It makes SDL_GetPrefPath(), when on Windows Phone 8.0, and when SDL_HINT_WINRT_PREF_PATH_ROOT is set to "roaming", return NULL, rather than silently defaulting to a Local path (then switching to a Roaming path if and when the user upgraded to Windows Phone 8.1).
David Ludwig ecc01474 2014-11-27T09:55:34 WinRT: added SDL_HINT_WINRT_PREF_PATH_ROOT SDL_HINT_WINRT_PREF_PATH_ROOT allows WinRT apps to alter the path that SDL_GetPrefPath() returns. Setting it to "local" uses the app's OS-defined Local folder, setting it to "roaming" uses the app's OS-defined Roaming folder. Roaming folder support is not available in Windows Phone 8.0. Attempts to make SDL_GetPrefPath() return a Roaming folder on this OS will be ignored. Various bits of documentation on this were added to SDL_hints.h, and to README-winrt.md
David Ludwig 506a1efc 2014-11-27T08:50:11 WinRT: removed a completed TODO item from an inline comment
David Ludwig d9a42c76 2014-11-23T08:59:01 WinRT: fixed an invalid comment in SDL_GetPrefPath() (for WinRT)
David Ludwig 13c51169 2014-11-23T08:52:10 WinRT: allowed 'roaming' and 'temp' folder paths to be retrieved on WinPhone 8.1 Windows Phone 8.0 either did not define, or provide access to, a 'RoamingFolder' or 'TemporaryFolder' for apps to use. Windows 8.0 and 8.1 do, as does Windows Phone 8.1. This change allows SDL-based Windows Phone 8.1 apps to access these folders, via either the SDL_WinRTGetFSPathUNICODE() or SDL_WinRTGetFSPathUTF8() functions. SDL_GetPrefPath(), which on WinRT, is based on SDL_WinRTGetFSPathUTF8(), will continue to return the app's 'local' folder, despite Windows 8.x counterpart apps using the 'roaming' folder, in order to preserve compatibility when 8.0-based Phone apps upgrade to 8.1-based Phone apps.
Philipp Wiesemann 9c398852 2014-11-22T22:20:40 Corrected header file documentation comment.
Pierre-Loup A. Griffais 24c86b55 2014-09-11T19:24:42 [X11] Reconcile logical keyboard state with physical state on FocusIn since the window system doesn't do it for us like other platforms. This prevents sticky keys and missed keys when going in and out of focus, for example Alt would appear to stick if switching away from an SDL app with Alt-Tab and had to be pressed again. CR: Sam
Alex Szpakowski b1a0bd10 2014-08-20T17:20:22 Merged default into iOS-improvements
Sam Lantinga d1cc47b3 2014-08-17T15:07:00 Fixed 2680 - OSX: Replace NSAutoreleasePool with @autoreleasepool Tim McDaniel This patch replaces all use of NSAutoreleasePool with the Apple recommended @autoreleasepool. @autoreleasepool is supposedly more efficient, and since it is scope based it can't be accidentally not released.
Sam Lantinga 05d87800 2014-08-11T17:25:53 Implemented SDL_GetPrefPath() on Android - it returns the path used by SDL_AndroidGetInternalStoragePath()
Alex Szpakowski 734b5233 2014-07-14T16:50:25 Misc. iOS code improvements. - Use @autoreleasepool instead of NSAutoReleasePool. - Code style fixups.
Gabriel Jacobo 6c5cb540 2014-06-20T11:01:05 Ooops, code that resists erasure, I've seen that in a movie.
Gabriel Jacobo 715a9829 2014-06-18T10:04:21 Fix file name typo, thanks Sam Clegg!
Gabriel Jacobo efa2d058 2014-06-08T18:18:13 Fixes audio for Native Client, and other fixes... - SDL_NaClMount, SDL_NaClUmount - Default mounting of https at / in SDL's main function - More documentation in README-nacl.txt
Brandon Schaefer 1f716769 2014-06-05T15:29:23 Fix warnings, only major one being an SDL_SetError not providing enough arguments.
David Ludwig 3dcb451f 2014-04-09T21:29:19 Added a README file regarding WinRT support To note, this file is currently formatted with CRLF line endings, rather than LF, to allow the file to be viewed with Notepad.
Sam Lantinga f9a58968 2014-03-13T21:21:26 Added missing copyright notices
David Ludwig e8eb1427 2014-03-10T21:21:35 build fixes for most WinRT-related files Still TODO: getting the D3D11 renderer back up and running in VC 2012.
Ryan C. Gordon 8c7ee701 2014-03-10T00:48:41 Removed unused variable.
Sam Lantinga 1367bf87 2014-03-09T11:36:47 Integrated David Ludwig's support for Windows RT
Sam Lantinga 05c23063 2014-03-09T11:06:11 Fixed line endings on WinRT source code
Ryan C. Gordon 3e541f30 2014-03-01T20:28:40 Force Windows version of SDL_GetPrefPath() to Unicode, create missing dirs. Fixes Bugzilla #2273.
Sam Lantinga 58edac3e 2014-02-02T00:53:27 Fixed bug 2374 - Update copyright for 2014... Is it that time already??
Gabriel Jacobo f848adff 2013-11-29T10:06:08 Improve Android pause/resume behavior.
David Ludwig 46740a5a 2013-11-28T22:09:21 WinRT: merged with latest SDL 2.x/HG code SDL 2.x recently accepted patches to enable OpenGL ES 2 support via Google's ANGLE library. The thought is to try to eventually merge SDL/WinRT's OpenGL code with SDL-official's.
Ryan C. Gordon 7e1289af 2013-11-24T23:56:17 Make internal SDL sources include SDL_internal.h instead of SDL_config.h The new header will include SDL_config.h, but allows for other global stuff.
Ryan C. Gordon 00003e8c 2013-11-14T11:51:24 Renamed things named after BeOS to be named after Haiku instead.
David Ludwig ea12ff9f 2013-10-28T15:52:04 WinRT: added a comment regarding the lack of SHGetFolderPath on WinRT
David Ludwig 3236fc3a 2013-10-28T15:41:22 WinRT: implemented SDL_GetBasePath and SDL_GetPrefPath
Ryan C. Gordon 609b58e4 2013-10-24T00:00:10 Fixed buffer overflow.
Ryan C. Gordon 28aa076c 2013-10-23T00:58:20 SDL_GetPrefPath() now uses the organization on all platforms. Even if that's not the general convention for a given platform.
Sam Lantinga deb8086b 2013-10-21T00:20:27 Fixed bug 2072 - Make OS X's filesystem calls use -[NSString fileSystemRepresentation] C.W. Betts The recommended way of getting a file name that POSIX file APIs can open in OS X when using an NSString is -[NSString fileSystemRepresentation]. However, the current filesystem API in hg uses -[NSString UTF8String].
Sam Lantinga 69a4351e 2013-09-30T22:35:32 Fixed bug 2121 - GCC throws error on SDL_FORCE_INLINE when compiling with -ansi
Sam Lantinga f79fc33a 2013-08-29T08:29:21 Christoph Mallon: Remove pointless if (x) before SDL_free(x)
Sam Lantinga 1d2c7796 2013-08-29T08:27:25 Christoph Mallon: Correct indendation.
Sam Lantinga 7267ea8f 2013-08-29T08:26:55 Christoph Mallon: Use SDL_arraysize()
Sam Lantinga 67c10169 2013-08-29T08:25:54 Christoph Mallon: Report an error, if creating the directories in SDL_GetPrefPath() failed.
Sam Lantinga db7c92b4 2013-08-29T08:25:24 Christoph Mallon: Remove lone /* if */ comment.
Sam Lantinga 321aa4ae 2013-08-29T08:24:43 Christoph Mallon: Simplify avoidance of duplicate / in SDL_GetPrefPath()
Edward Rudd 833fd30e 2013-08-25T11:24:01 reworked GetBasePath on OS X to use Contents/Resource by default if bundled, or exedir if not bundled. - also adds OS X specific magic for bundled apps adding an Info.plist property of name SDL_FILESYSTEM_BASE_DIR_TYPE to the following values will change the bahaviour. * bundle -- use the bundle directory e.g. "/Applications/MyGame/Blah.app/" * parent -- use the bundle parent directory e.g. "/Applications/MyGame/" * resource -- use the bundle resource directory (default) e.g. "/Applications/MyGame/Blah.app/Contents/Resources/"
Ryan C. Gordon c9c6852f 2013-08-24T21:15:10 Minor FreeBSD code cleanup.
Edward Rudd e5b65e4e 2013-08-24T09:05:18 Fix #2062 Be more diligent about validating trailing "/" existence in HOME and XDG_DATA_HOME env vars
Ryan C. Gordon 58a558e3 2013-08-23T23:34:23 Patched to compile on Solaris.
Ryan C. Gordon 88cd94a0 2013-08-23T21:48:40 Patched to compile on FreeBSD.
Ryan C. Gordon 97948aef 2013-08-23T21:38:54 Add support for some BSDs and Solaris to SDL_GetBasePath().
Ryan C. Gordon 3984c7d8 2013-08-20T23:20:32 Actually, this should be a memcpy(). We already know the exact length we just allocated, and we plan to append our own null terminator to the end of the copy, so this makes more sense.
Ryan C. Gordon 9ff379ba 2013-08-20T21:21:57 Patched to compile on iOS.
Ryan C. Gordon fb7a0291 2013-08-20T20:39:22 More Haiku fixes.
Ryan C. Gordon ad8aa33b 2013-08-20T20:29:30 More Windows fixes for filesystem code.
Ryan C. Gordon c9152adc 2013-08-20T20:15:15 Patched new filesystem code to compile.
Ryan C. Gordon 2dd7091e 2013-08-20T19:57:11 Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module.