@@ -1766,7 +1766,8 @@ void UnloadRandomSequence(int *sequence)
1766
1766
#endif
1767
1767
}
1768
1768
1769
- // Takes a screenshot of current screen (saved a .png)
1769
+ // Takes a screenshot of current screen
1770
+ // NOTE: Provided fileName should not contain paths, saving to working directory
1770
1771
void TakeScreenshot (const char * fileName )
1771
1772
{
1772
1773
#if defined(SUPPORT_MODULE_RTEXTURES )
@@ -1778,12 +1779,13 @@ void TakeScreenshot(const char *fileName)
1778
1779
Image image = { imgData , (int )((float )CORE .Window .render .width * scale .x ), (int )((float )CORE .Window .render .height * scale .y ), 1 , PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 };
1779
1780
1780
1781
char path [512 ] = { 0 };
1781
- strcpy (path , TextFormat ("%s/%s" , CORE .Storage .basePath , fileName ));
1782
-
1782
+ strcpy (path , TextFormat ("%s/%s" , CORE .Storage .basePath , GetFileName ( fileName ) ));
1783
+
1783
1784
ExportImage (image , path ); // WARNING: Module required: rtextures
1784
1785
RL_FREE (imgData );
1785
1786
1786
- TRACELOG (LOG_INFO , "SYSTEM: [%s] Screenshot taken successfully" , path );
1787
+ if (FileExists (path )) TRACELOG (LOG_INFO , "SYSTEM: [%s] Screenshot taken successfully" , path );
1788
+ else TRACELOG (LOG_WARNING , "SYSTEM: [%s] Screenshot could not be saved" , path );
1787
1789
#else
1788
1790
TRACELOG (LOG_WARNING ,"IMAGE: ExportImage() requires module: rtextures" );
1789
1791
#endif
@@ -1836,10 +1838,10 @@ bool IsFileExtension(const char *fileName, const char *ext)
1836
1838
{
1837
1839
#if defined(SUPPORT_MODULE_RTEXT ) && defined(SUPPORT_TEXT_MANIPULATION )
1838
1840
int extCount = 0 ;
1839
- const char * * checkExts = TextSplit (ext , ';' , & extCount ); // WARNING: Module required: rtext
1841
+ const char * * checkExts = TextSplit (ext , ';' , & extCount ); // WARNING: Module required: rtext
1840
1842
1841
1843
char fileExtLower [MAX_FILE_EXTENSION_SIZE + 1 ] = { 0 };
1842
- strncpy (fileExtLower , TextToLower (fileExt ), MAX_FILE_EXTENSION_SIZE ); // WARNING: Module required: rtext
1844
+ strncpy (fileExtLower , TextToLower (fileExt ), MAX_FILE_EXTENSION_SIZE ); // WARNING: Module required: rtext
1843
1845
1844
1846
for (int i = 0 ; i < extCount ; i ++ )
1845
1847
{
0 commit comments