Petar Popovic
67ac0e5eee
SDL_InternalGlobDirectory(): set string length of base directory to 1, if it's just one slash
2026-03-07 12:43:56 -05:00
Petar Popovic
93e3e8a5fe
SDL_InternalGlobDirectory(): keep track of pathlen and reuse it, instead of calling SDL_strlen(path)
2026-03-07 12:43:56 -05:00
Petar Popovic
961a04fa26
SDL_GlobDirectory(): Don't chop off first slash from path, if it's just multiple slashes
2026-03-07 12:43:56 -05:00
Alex Threlfo
6583134365
filesystem: Fix Android asset enumeration
...
Passes expected relative paths to Android's AssetManager API instead of
absolute ones + fixes some indexing logic with trailing slashes.
2026-02-20 15:10:52 -08:00
Ryan C. Gordon
a3b0403412
filesystem: Fix SDL_GlobDirectory on iOS and Android.
...
It SDL_SYS_EnumerateDirectory was changing the path string and passing it to
the callback, causing chaos in the glob handler, which expected the original
string to pass through.
Fixes #15057 .
2026-02-17 19:41:20 -05:00
RaceTheMaSe
6f754e5c03
Fix warnings: extra semi - spurious ( #15014 )
2026-02-09 11:48:58 -08:00
Sam Lantinga
a0307589bd
iOS: if the file doesn't exist in the pref path, use the current directory
...
Fixes https://github.com/libsdl-org/SDL/issues/14743
2026-01-02 08:19:28 -08:00
Sam Lantinga
5f086e7623
Updated copyright for 2026
2026-01-01 09:40:08 -08:00
Edgar J San Martin
09a2283b53
Fix SDL_EnumerateDirectory(/) failing on POSIX and Windows.
2025-12-15 17:01:02 -08:00
Sam Lantinga
4bc9ab665d
Use a base path of "./" on Android
...
This allows filesystem operations to use internal storage and the asset system by default.
2025-11-15 11:29:37 -08:00
Sam Lantinga
9f9952d53a
Fixed filesystem operations on iOS
...
Full paths are used as-is, relative paths are prepended with a writable path, SDL_GetPrefPath("", ""), since the current directory isn't writable.
2025-09-22 10:09:30 -07:00
Sam Lantinga
26dd4e3abb
Fixed filesystem operations on Android
...
Full paths are used as-is, relative paths are prepended with SDL_GetAndroidInternalStoragePath(), and operations fall back to the asset system as appropriate.
This is consistent with the behavior of opening files on Android.
2025-09-21 18:23:34 -07:00
Sam Lantinga
25b2d2c821
Use new parameter validation macro
2025-09-18 20:58:32 -07:00
Ethan Lee
4ee79e6493
filesystem: GetCurrentDirectory now falls back to GetBasePath when unsupported
2025-09-18 14:49:03 -04:00
nightmareci
2f5bc17ea6
Fix support for Windows XP and up ( #13904 )
2025-09-08 13:00:26 -07:00
Frank Praznik
fdfde42db1
fs: Fix OpenBSD path retrieval
...
Set the path start pointer to point to a valid string.
2025-08-29 19:03:44 -04:00
Ryan C. Gordon
af1c05fd58
filesystem: Check SDL_GetPrefPath parameters at the higher level.
...
...so the backends don't have to do it.
Also added a stern warning about `org` being omitted, but leaving it as
allowed so as not to break existing apps (more than they are already broken,
at least).
Fixes #13322 .
2025-07-22 12:28:01 -04:00
Ryan C. Gordon
515433aa8a
android: If various POSIX fsops functions fail, try using AAssetManager.
...
This specifically affects SDL_EnumerateDirectory and SDL_GetPathInfo. Android
assets are read-only, so no need to do this for things like
SDL_CreateDirectory, etc, and the POSIX SDL_CopyFile() uses SDL_IOStream
behind the scenes, which already supports Android assets.
Fixes #13050 .
2025-07-11 14:16:18 -04:00
Ryan C. Gordon
343ad3eddd
ngage: SDL_GetPrefPath allows a NULL org parameter.
...
Reference Issue #13322 .
2025-07-05 12:21:13 -04:00
Sam Lantinga
d7939abf42
Use consistent style for pointer declarations and casts
2025-06-18 10:03:44 -07:00
Michael Fitzmayer
7ae64592c9
Restore support for the Nokia N-Gage ( #12148 )
2025-05-22 11:07:22 -07:00
nmlgc
37b86a6d2f
windows: fix Unicode function and type inconsistencies
...
The surrounding code in all of these instances expects the Unicode
variants. Previously, this code mixed Unicode and ANSI/ASCII calls if
`UNICODE` was undefined, which caused type and logic errors. Explicitly
spelling out the W removes any reliance on that macro.
2025-05-08 07:22:11 -07:00
Alexander Batalov
b3336c5a73
Match style
2025-02-27 07:10:09 -08:00
Alexander Batalov
2b784b5bf6
Fix SDL_GlobDirectory
2025-02-27 07:10:09 -08:00
John Alanbrook
14edb21aec
check for backslashes as well as the forward slash
2025-01-30 12:41:48 -08:00
nightmareci
718034f5fa
Remove newlines from log messages
2025-01-22 20:25:04 -08:00
Ryan C. Gordon
eb793dede7
filesystem: SDL_GetCurrentDirectory() should add a path separator at the end.
2025-01-16 08:19:28 -05:00
Ryan C. Gordon
87e1b0eb89
filesystem: SDL_EnumerateDirectory() gives dirs with path seperators appended.
...
Fixes #11065 .
Fixes #11427 .
2025-01-16 08:19:28 -05:00
Ryan C. Gordon
84d35587ee
filesystem: SDL_SYS_EnumerateDirectory inexplicably takes the same arg twice.
2025-01-15 14:09:33 -05:00
Sam Lantinga
f2074d7af3
Updated copyright for 2025
2025-01-01 07:45:52 -08:00
Ethan Lee
9628549c7c
Xbox buildfixes
2024-12-13 11:34:39 -05:00
Ryan C. Gordon
f852038384
filesystem: Added SDL_GetCurrentDirectory().
...
Fixes #11531 .
2024-11-27 23:42:11 -05:00
Petar Popovic
cb0c7c9680
SDL_CreateDirectory(): directory tree creation for absolute paths for non-Windows platforms
2024-10-28 01:56:48 -04:00
Petar Popovic
a10578acbd
SDL_SYS_RenamePath(): Fix error message.
2024-10-27 16:54:13 -07:00
Petar Popovic
8468c372b2
SDL_EnumerateDirectory(): (posix) Fix return value when directory is invalid
2024-10-25 22:52:56 -07:00
kyle-sylvestre
22bc430bbb
Set error using function hresult
2024-10-23 10:53:46 -07:00
Sam Lantinga
4fa92d233d
Include stdbool.h when using Visual Studio 2017+
...
Also cleaned up some incorrect return values from bool functions.
2024-10-01 09:57:59 -07:00
Ryan C. Gordon
6a7f8b74f1
filesystem: SDL_GlobDirectory shouldn't strip final '/' if the path is "/".
...
This is common on Emscripten, where the base directory is "/".
2024-09-29 23:09:04 -04:00
Ryan C. Gordon
7d21a49c9c
filesystem: SDL_EnumerateDirectoryCallback uses an enum now, not an int.
...
Fixes #10955 .
2024-09-28 01:33:40 -04:00
Ryan C. Gordon
4a296f1bde
filesystem: Fixed memory leak on Windows.
2024-09-27 18:54:18 -04:00
Ryan C. Gordon
428f2f35be
filesystem: SDL_CreateDirectory should make parent directories.
...
Fixes #10502 .
2024-09-27 18:54:18 -04:00
Ryan C. Gordon
94030131de
filesystem: Windows SDL_SYS_CreateDirectory should succeed if dir exists.
2024-09-27 18:54:18 -04:00
Ryan C. Gordon
d8c76d2f34
filesystem: POSIX SDL_SYS_CopyFile shouldn't use a temp file.
...
Fixes #10957 .
2024-09-26 19:34:34 -04:00
Ryan C. Gordon
f267ec7681
filesystem: Improve docs, make some promises about overwrites and file caches.
...
Note that SDL_FlushIO() doesn't make promises about file data sync but that
is intended to be changed in the IOStream code in a later commit.
Fixes #10886 .
2024-09-26 19:29:03 -04:00
Ryan C. Gordon
38f971bac5
filesystem: SDL_SYS_EnumerateDirectory() now returns bool.
2024-09-26 16:35:15 -04:00
Sam Lantinga
a90ad3b0e2
Removed SDL_bool in favor of plain bool
...
We require stdbool.h in the build environment, so we might as well use the plain bool type.
If your environment doesn't have stdbool.h, this simple replacement will suffice:
typedef signed char bool;
2024-09-18 08:32:30 -07:00
Sam Lantinga
28b94c4758
Re-added SDL_getenv() as a thread-safe getenv() implementation
2024-09-15 09:37:04 -07:00
Sam Lantinga
90e01040c5
Added thread-safe environment functions
...
Also marked the existing functions as unsafe, as they can cause crashes if used in multi-threaded applications.
As a bonus, since the new functions are hashtable based, hint environment lookups are much faster.
2024-09-13 22:14:54 -07:00
Sam Lantinga
37c9fb490e
Changed enums to use XXX_COUNT for the count or number of values
...
Fixes https://github.com/libsdl-org/SDL/issues/10763
2024-09-11 09:32:17 -07:00
Ryan C. Gordon
154452a726
winrt: Removed WinRT/Windows Phone/UWP support.
...
Fixes #10724 .
2024-09-06 13:28:39 -04:00