You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using SDL_Storage, I found that SDL_GlobStorageDirectory didn't work unless I set my override prefix to an empty string and set the cwd to the base path (either by chdir or just launching the game from the correct folder). I was confused as to why neither NULL nor SDL_GetBasePath() worked as arguments. I first noticed this on mac, but it occurred when I set up a new windows build as well.
My usage of SDL_Storage looks like this
SDL_Storage* titleStorage = SDL_OpenTitleStorage(NULL, 0);
int numFiles = 0;
char** files = SDL_GlobStorageDirectory(titleStorage, ".", "*.spv", 0, &numFiles);
assert(files && numFiles != 0); // there are definitely a few .spv files in the directory
After doing some digging, it seems like the issue is most immediately in GlobDirectoryCallback where the callback userdata's basedirlen field is set to the length of "." + 1 in SDL_InternalGlobDirectory, but in GENERIC_EnumerateStorageDirectory, the path is expanded with the storage's basepath, so most of the basedir portion of the path is passed to WildcardMatch, which immediately fails when it sees a '/'.
I was hoping this would be a small fix, but as far as I can tell, there's nowhere in the call stack that knows that we are doing directory enumeration with GlobDirCallbackData and knows that we're using a storage object except SDL_GlobStorageDirectory, but that doesn't have access to the GENERIC_INTERNAL_GetCreateFullPath, so as far as I can tell, some rearchitecting is required to pass this information around correctly. I believe the way GlobDirCallbackData is written is to support matching patterns in subpaths, but given how WildcardMatch seems to reject any '/' characters, that might be a separate but related issue.
The text was updated successfully, but these errors were encountered:
When using SDL_Storage, I found that SDL_GlobStorageDirectory didn't work unless I set my override prefix to an empty string and set the cwd to the base path (either by chdir or just launching the game from the correct folder). I was confused as to why neither NULL nor SDL_GetBasePath() worked as arguments. I first noticed this on mac, but it occurred when I set up a new windows build as well.
My usage of SDL_Storage looks like this
After doing some digging, it seems like the issue is most immediately in GlobDirectoryCallback where the callback userdata's basedirlen field is set to the length of "." + 1 in SDL_InternalGlobDirectory, but in GENERIC_EnumerateStorageDirectory, the path is expanded with the storage's basepath, so most of the basedir portion of the path is passed to WildcardMatch, which immediately fails when it sees a '/'.
I was hoping this would be a small fix, but as far as I can tell, there's nowhere in the call stack that knows that we are doing directory enumeration with GlobDirCallbackData and knows that we're using a storage object except SDL_GlobStorageDirectory, but that doesn't have access to the GENERIC_INTERNAL_GetCreateFullPath, so as far as I can tell, some rearchitecting is required to pass this information around correctly. I believe the way GlobDirCallbackData is written is to support matching patterns in subpaths, but given how WildcardMatch seems to reject any '/' characters, that might be a separate but related issue.
The text was updated successfully, but these errors were encountered: