Fix FSChangeDirAsync hook to always make sure the directory ends with "/"

This commit is contained in:
Maschell 2021-01-09 16:08:53 +01:00
parent 4551e08745
commit 4229909519

View File

@ -347,6 +347,11 @@ DECL_FUNCTION(FSStatus, FSGetFreeSpaceSizeAsync, FSClient *client, FSCmdBlock *b
DECL_FUNCTION(FSStatus, FSChangeDirAsync, FSClient *client, FSCmdBlock *block, const char *path, FSErrorFlag errorMask, FSAsyncData *asyncData) {
DEBUG_FUNCTION_LINE("FSChangeDirAsync %s", path);
strncpy(gWorkingDir, path, sizeof(gWorkingDir));
int len = strlen(gWorkingDir);
if(len > 0 && gWorkingDir[len-1] != '/'){
gWorkingDir[len-1] = '/';
gWorkingDir[len] = 0;
}
DCFlushRange(gWorkingDir, sizeof(gWorkingDir));
return real_FSChangeDirAsync(client, block, path, errorMask, asyncData);
}