SDL: Simplified SDL_SYS_RemovePath()

From 05b57f6c2cbb4103f4ece01ab0a9182679d3b02f Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 21 Mar 2024 21:16:14 -0700
Subject: [PATCH] Simplified SDL_SYS_RemovePath()

If we get ENOENT we call that success. If the parent directory doesn't exist, that's fine, other operations on it will fail if it matters to the application.
---
 src/filesystem/posix/SDL_sysfsops.c | 23 ++++-------------------
 1 file changed, 4 insertions(+), 19 deletions(-)

diff --git a/src/filesystem/posix/SDL_sysfsops.c b/src/filesystem/posix/SDL_sysfsops.c
index fcc38ed9bbda5..857782eb6ec63 100644
--- a/src/filesystem/posix/SDL_sysfsops.c
+++ b/src/filesystem/posix/SDL_sysfsops.c
@@ -59,26 +59,11 @@ int SDL_SYS_RemovePath(const char *path)
 {
     int rc = remove(path);
     if (rc < 0) {
-        const int origerrno = errno;
-        if (origerrno == ENOENT) {
-            char *parent = SDL_strdup(path);
-            if (!parent) {
-                return -1;
-            }
-
-            char *ptr = SDL_strrchr(parent, '/');
-            if (ptr) {
-                *ptr = '\0';  // chop off thing we were removing, see if parent is there.
-            }
-
-            struct stat statbuf;
-            rc = stat(ptr ? parent : ".", &statbuf);
-            SDL_free(parent);
-            if (rc == 0) {
-                return 0;  // it's already gone, and parent exists, consider it success.
-            }
+        if (errno == ENOENT) {
+            // It's already gone, this is a success
+            return 0;
         }
-        return SDL_SetError("Can't remove path: %s", strerror(origerrno));
+        return SDL_SetError("Can't remove path: %s", strerror(errno));
     }
     return 0;
 }