diff --git a/src/rcore.c b/src/rcore.c index 80d1cbf11..ec4d8a473 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -1804,7 +1804,6 @@ void UnloadRandomSequence(int *sequence) } // Takes a screenshot of current screen -// NOTE: Provided fileName should not contain paths, saving to working directory void TakeScreenshot(const char *fileName) { #if SUPPORT_MODULE_RTEXTURES @@ -1819,7 +1818,8 @@ void TakeScreenshot(const char *fileName) Image image = { imgData, (int)((float)CORE.Window.render.width*scale.x), (int)((float)CORE.Window.render.height*scale.y), 1, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 }; char path[MAX_FILEPATH_LENGTH] = { 0 }; - snprintf(path, MAX_FILEPATH_LENGTH, "%s", TextFormat("%s/%s", CORE.Storage.basePath, fileName)); + if (!IsPathAbsolute(fileName)) snprintf(path, MAX_FILEPATH_LENGTH, "%s", TextFormat("%s/%s", CORE.Storage.basePath, fileName)); + else snprintf(path, MAX_FILEPATH_LENGTH, "%s", fileName); ExportImage(image, path); // WARNING: Module required: rtextures RL_FREE(imgData);