Commit graph

77 commits

Author SHA1 Message Date
Sam Lantinga
c4c43627bb 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.
2019-07-18 19:33:17 -07:00
Sam Lantinga
af32a2f4cd Updated copyright for 2019 2019-01-04 22:01:14 -08:00
sezero
d9c8979193 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.
2018-02-12 17:00:00 +03:00
Sam Lantinga
e9a1c0c9d0 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
2018-01-30 18:08:34 -08:00
Sam Lantinga
346af016a5 Updated copyright for 2018 2018-01-03 10:03:25 -08:00
Ryan C. Gordon
f07a0b3b5d filesystem: Patched to compile on QNX. 2017-08-17 03:22:44 -04:00
Ryan C. Gordon
d5066e8edb filesystem: QNX should use SDL_LoadFile() instead of rolling it from scratch. 2017-08-17 02:58:46 -04:00
Ryan C. Gordon
edeabbcec9 qnx: Implemented SDL_GetBasePath(). 2017-08-17 01:25:48 -04:00
Sam Lantinga
ebae122371 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.
2017-08-11 11:32:00 -07:00
Philipp Wiesemann
b06a75d176 haiku: Changed header paths to be more compatible. 2017-07-29 23:00:14 +02:00
Philipp Wiesemann
ea5028f893 haiku: Fixed missing slash in path from SDL_GetPrefPath(). 2017-06-17 22:30:09 +02:00
Philipp Wiesemann
2172c1bd41 android: Fixed missing error message for SDL_GetBasePath(). 2017-06-04 23:15:27 +02:00
Philipp Wiesemann
aaa20b5e5a Removed unused errno includes. 2017-05-27 23:30:07 +02:00
Sam Lantinga
1b24bfad38 Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Philipp Wiesemann
74cf2bf6b2 Fixed compiling if filesystem is disabled (thanks, Elias!).
Fixes Bugzilla #3414.
2016-08-30 21:14:13 +02:00
Sam Lantinga
414d85cd8a David Carlier implemented SDL_GetBasePath() for OpenBSD 2016-01-31 21:11:15 -08:00
Sam Lantinga
7ee8dda270 Updated copyright to 2016 2016-01-02 10:10:34 -08:00
Ryan C. Gordon
4fe50008e4 Windows SDL_GetBasePath: free string on failure.
--HG--
extra : rebase_source : c9015ad1e60607cbd3204ba44d9cfaec6f1adad7
2015-05-28 15:36:27 -04:00
Ryan C. Gordon
b22d989ad8 Windows GetBasePath: fixed reallocation code.
--HG--
extra : rebase_source : 3b2cf31f9d42d7925e3200dcae98af36159a5bc0
2015-05-28 15:32:45 -04:00
Ryan C. Gordon
ae904749d0 Windows SDL_GetBasePath: Fixed wrong variable when growing the buffer size.
--HG--
extra : rebase_source : 57286d2f315dbb6b68321326e506d26469651afa
2015-05-28 15:29:43 -04:00
Sam Lantinga
ed2f60d082 Fixed compiling and tested on Windows 2015-05-28 12:06:48 -07:00
Ryan C. Gordon
9f2772eae0 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.
2015-05-28 01:54:52 -04:00
Sam Lantinga
56b58afdbe Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
Philipp Wiesemann
2a45a031a7 Emscripten: Fixed memory leak if SDL_GetPrefPath() failed. 2015-04-15 21:25:15 +02:00
Alex Szpakowski
0bacddf42e Merged default into iOS-improvements
--HG--
branch : iOS-improvements
2015-04-06 15:26:37 -03:00
Alex Szpakowski
f2452bba77 Merged default into iOS-improvements
--HG--
branch : iOS-improvements
2015-01-15 01:15:24 -04:00
Philipp Wiesemann
af3327018f Fixed comment in implementation for NaCl. 2015-01-31 21:06:37 +01:00
Ryan C. Gordon
de88474dda 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!)

--HG--
extra : rebase_source : 97af74c8a5121e926ebe89f123536b5dd6681695
2014-12-18 00:19:52 -05:00
David Ludwig
594785a021 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.
2014-12-02 21:18:50 -05:00
Alex Szpakowski
dcfb9a729a Merged default into iOS-improvements
--HG--
branch : iOS-improvements
2014-12-02 02:52:45 -04:00
David Ludwig
cba7a719d8 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).
2014-11-29 10:09:30 -05:00
David Ludwig
fda1375d4e 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
2014-11-27 09:55:34 -05:00
David Ludwig
bca0f114eb WinRT: removed a completed TODO item from an inline comment 2014-11-27 08:50:11 -05:00
David Ludwig
22af98b953 WinRT: fixed an invalid comment in SDL_GetPrefPath() (for WinRT) 2014-11-23 08:59:01 -05:00
David Ludwig
5da7c20541 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.

--HG--
extra : rebase_source : ffd5850a1329cb3e09d06633b18521f17fd82658
2014-11-23 08:52:10 -05:00
Alex Szpakowski
fdce275074 Merged default into iOS-improvements
--HG--
branch : iOS-improvements
2014-08-20 17:20:22 -03:00
Sam Lantinga
cf85a26a30 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.
2014-08-17 15:07:00 -07:00
Sam Lantinga
c1d6f15368 Implemented SDL_GetPrefPath() on Android - it returns the path used by SDL_AndroidGetInternalStoragePath() 2014-08-11 17:25:53 -07:00
Alex Szpakowski
c351e27667 Misc. iOS code improvements.
- Use @autoreleasepool instead of NSAutoReleasePool.

- Code style fixups.

--HG--
branch : iOS-improvements
2014-07-14 16:50:25 -03:00
Gabriel Jacobo
b9b706f832 Ooops, code that resists erasure, I've seen that in a movie. 2014-06-20 11:01:05 -03:00
Gabriel Jacobo
aa762e77a3 Fix file name typo, thanks Sam Clegg!
--HG--
rename : src/filesystem/nacl/SDL_sysfilesytem.c => src/filesystem/nacl/SDL_sysfilesystem.c
2014-06-18 10:04:21 -03:00
Gabriel Jacobo
37f6d3cb88 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
2014-06-08 18:18:13 -03:00
Brandon Schaefer
d5eb114f44 Fix warnings, only major one being an SDL_SetError not providing enough arguments. 2014-06-05 15:29:23 -07:00
Sam Lantinga
82a301e171 Added missing copyright notices 2014-03-13 21:21:26 -07:00
David Ludwig
e6f24f0b7c build fixes for most WinRT-related files
Still TODO: getting the D3D11 renderer back up and running in VC 2012.

--HG--
extra : rebase_source : 16aa0948fea2b8997033ca5a09ddb9692d07edc4
2014-03-10 21:21:35 -04:00
Ryan C. Gordon
5b8f5159f3 Removed unused variable. 2014-03-10 00:48:41 -04:00
Sam Lantinga
a7d2ebb8d6 Integrated David Ludwig's support for Windows RT 2014-03-09 11:36:47 -07:00
Sam Lantinga
211b54deef Fixed line endings on WinRT source code 2014-03-09 11:06:11 -07:00
Ryan C. Gordon
267f8fb155 Force Windows version of SDL_GetPrefPath() to Unicode, create missing dirs.
Fixes Bugzilla #2273.
2014-03-01 20:28:40 -05:00
Sam Lantinga
d7940a513e Fixed bug 2374 - Update copyright for 2014...
Is it that time already??
2014-02-02 00:53:27 -08:00