mirror of
https://github.com/raysan5/raylib.git
synced 2026-10-11 04:01:54 -04:00
Compare commits
5 Commits
f9c2abdc9e
...
550dd0e3a8
| Author | SHA1 | Date | |
|---|---|---|---|
| 550dd0e3a8 | |||
| e9d75a4fe9 | |||
| 1829f9282c | |||
| 08a8068702 | |||
| 3449d81f67 |
@ -1149,6 +1149,7 @@ RLAPI int FileTextFindIndex(const char *fileName, const char *search); // Find t
|
|||||||
RLAPI bool FileExists(const char *fileName); // Check if file exists
|
RLAPI bool FileExists(const char *fileName); // Check if file exists
|
||||||
RLAPI bool DirectoryExists(const char *dirPath); // Check if directory path exists
|
RLAPI bool DirectoryExists(const char *dirPath); // Check if directory path exists
|
||||||
RLAPI bool IsFileExtension(const char *fileName, const char *ext); // Check file extension (recommended include point: .png, .wav)
|
RLAPI bool IsFileExtension(const char *fileName, const char *ext); // Check file extension (recommended include point: .png, .wav)
|
||||||
|
RLAPI bool IsFileHidden(const char *filePath); // Check if file path (file or directory) is hidden by OS
|
||||||
RLAPI int GetFileLength(const char *fileName); // Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h)
|
RLAPI int GetFileLength(const char *fileName); // Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h)
|
||||||
RLAPI long GetFileModTime(const char *fileName); // Get file modification time (last write time)
|
RLAPI long GetFileModTime(const char *fileName); // Get file modification time (last write time)
|
||||||
RLAPI const char *GetFileExtension(const char *fileName); // Get pointer to extension for a filename string (includes dot: '.png')
|
RLAPI const char *GetFileExtension(const char *fileName); // Get pointer to extension for a filename string (includes dot: '.png')
|
||||||
|
|||||||
19
src/rcore.c
19
src/rcore.c
@ -165,6 +165,7 @@
|
|||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
__declspec(dllimport) unsigned long __stdcall GetFileAttributesA(const char *lpFileName);
|
||||||
__declspec(dllimport) unsigned long __stdcall GetModuleFileNameA(struct HINSTANCE__ *hModule, char *lpFilename, unsigned long nSize);
|
__declspec(dllimport) unsigned long __stdcall GetModuleFileNameA(struct HINSTANCE__ *hModule, char *lpFilename, unsigned long nSize);
|
||||||
__declspec(dllimport) unsigned long __stdcall GetModuleFileNameW(struct HINSTANCE__ *hModule, wchar_t *lpFilename, unsigned long nSize);
|
__declspec(dllimport) unsigned long __stdcall GetModuleFileNameW(struct HINSTANCE__ *hModule, wchar_t *lpFilename, unsigned long nSize);
|
||||||
__declspec(dllimport) int __stdcall WideCharToMultiByte(unsigned int cp, unsigned long flags, const wchar_t *widestr, int cchwide, char *str, int cbmb, const char *defchar, int *used_default);
|
__declspec(dllimport) int __stdcall WideCharToMultiByte(unsigned int cp, unsigned long flags, const wchar_t *widestr, int cchwide, char *str, int cbmb, const char *defchar, int *used_default);
|
||||||
@ -2412,6 +2413,24 @@ bool IsFileExtension(const char *fileName, const char *ext)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if file path (file or directory) is hidden by OS
|
||||||
|
bool IsFileHidden(const char *filePath)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
#if defined(_WIN32)
|
||||||
|
unsigned long attribs = GetFileAttributesA(filePath);
|
||||||
|
|
||||||
|
// Check !INVALID_FILE_ATTRIBUTES and FILE_ATTRIBUTE_HIDDEN
|
||||||
|
if ((attribs != -1) && ((attribs & 0x2UL) != 0)) result = true;
|
||||||
|
#else
|
||||||
|
const char *basePath = strrchr(filePath, '/');
|
||||||
|
basePath = (basePath? basePath + 1 : filePath);
|
||||||
|
|
||||||
|
if ((basePath[0] == '.') && (strcmp(basePath, ".") != 0) && (strcmp(basePath, "..") != 0)) result = true;
|
||||||
|
#endif
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if directory path exists
|
// Check if directory path exists
|
||||||
bool DirectoryExists(const char *dirPath)
|
bool DirectoryExists(const char *dirPath)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1411,8 +1411,8 @@
|
|||||||
"description": "Camera type fallback, defaults to Camera3D"
|
"description": "Camera type fallback, defaults to Camera3D"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "Transform",
|
"type": "Transform *",
|
||||||
"name": "*ModelAnimPose",
|
"name": "ModelAnimPose",
|
||||||
"description": "Anim pose, an array of Transform[]"
|
"description": "Anim pose, an array of Transform[]"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -4546,6 +4546,17 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "IsFileHidden",
|
||||||
|
"description": "Check if file path (file or directory) is hidden by OS",
|
||||||
|
"returnType": "bool",
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "const char *",
|
||||||
|
"name": "filePath"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "GetFileLength",
|
"name": "GetFileLength",
|
||||||
"description": "Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h)",
|
"description": "Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h)",
|
||||||
|
|||||||
@ -1411,8 +1411,8 @@ return {
|
|||||||
description = "Camera type fallback, defaults to Camera3D"
|
description = "Camera type fallback, defaults to Camera3D"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "Transform",
|
type = "Transform *",
|
||||||
name = "*ModelAnimPose",
|
name = "ModelAnimPose",
|
||||||
description = "Anim pose, an array of Transform[]"
|
description = "Anim pose, an array of Transform[]"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -4093,6 +4093,14 @@ return {
|
|||||||
{type = "const char *", name = "ext"}
|
{type = "const char *", name = "ext"}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name = "IsFileHidden",
|
||||||
|
description = "Check if file path (file or directory) is hidden by OS",
|
||||||
|
returnType = "bool",
|
||||||
|
params = {
|
||||||
|
{type = "const char *", name = "filePath"}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name = "GetFileLength",
|
name = "GetFileLength",
|
||||||
description = "Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h)",
|
description = "Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h)",
|
||||||
|
|||||||
@ -887,8 +887,8 @@
|
|||||||
(name "Camera")
|
(name "Camera")
|
||||||
(description "Camera type fallback, defaults to Camera3D"))
|
(description "Camera type fallback, defaults to Camera3D"))
|
||||||
|
|
||||||
((type "Transform")
|
((type "Transform *")
|
||||||
(name "*ModelAnimPose")
|
(name "ModelAnimPose")
|
||||||
(description "Anim pose, an array of Transform[]")))
|
(description "Anim pose, an array of Transform[]")))
|
||||||
|
|
||||||
(enums
|
(enums
|
||||||
@ -2970,6 +2970,12 @@
|
|||||||
((type "const char *") (name "fileName"))
|
((type "const char *") (name "fileName"))
|
||||||
((type "const char *") (name "ext"))))
|
((type "const char *") (name "ext"))))
|
||||||
|
|
||||||
|
((name "IsFileHidden")
|
||||||
|
(description "Check if file path (file or directory) is hidden by OS")
|
||||||
|
(return-type "bool")
|
||||||
|
(params
|
||||||
|
((type "const char *") (name "filePath"))))
|
||||||
|
|
||||||
((name "GetFileLength")
|
((name "GetFileLength")
|
||||||
(description "Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h)")
|
(description "Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h)")
|
||||||
(return-type "int")
|
(return-type "int")
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -303,7 +303,7 @@
|
|||||||
<Alias type="TextureCubemap" name="Texture" desc="TextureCubemap, same as Texture" />
|
<Alias type="TextureCubemap" name="Texture" desc="TextureCubemap, same as Texture" />
|
||||||
<Alias type="RenderTexture2D" name="RenderTexture" desc="RenderTexture2D, same as RenderTexture" />
|
<Alias type="RenderTexture2D" name="RenderTexture" desc="RenderTexture2D, same as RenderTexture" />
|
||||||
<Alias type="Camera" name="Camera3D" desc="Camera type fallback, defaults to Camera3D" />
|
<Alias type="Camera" name="Camera3D" desc="Camera type fallback, defaults to Camera3D" />
|
||||||
<Alias type="*ModelAnimPose" name="Transform" desc="Anim pose, an array of Transform[]" />
|
<Alias type="ModelAnimPose" name="Transform *" desc="Anim pose, an array of Transform[]" />
|
||||||
</Aliases>
|
</Aliases>
|
||||||
<Enums count="21">
|
<Enums count="21">
|
||||||
<Enum name="ConfigFlags" valueCount="16" desc="System/Window config flags">
|
<Enum name="ConfigFlags" valueCount="16" desc="System/Window config flags">
|
||||||
@ -681,7 +681,7 @@
|
|||||||
<Param type="unsigned int" name="frames" desc="" />
|
<Param type="unsigned int" name="frames" desc="" />
|
||||||
</Callback>
|
</Callback>
|
||||||
</Callbacks>
|
</Callbacks>
|
||||||
<Functions count="618">
|
<Functions count="619">
|
||||||
<Function name="InitWindow" retType="void" paramCount="3" desc="Initialize window and OpenGL context">
|
<Function name="InitWindow" retType="void" paramCount="3" desc="Initialize window and OpenGL context">
|
||||||
<Param type="int" name="width" desc="" />
|
<Param type="int" name="width" desc="" />
|
||||||
<Param type="int" name="height" desc="" />
|
<Param type="int" name="height" desc="" />
|
||||||
@ -1084,6 +1084,9 @@
|
|||||||
<Param type="const char *" name="fileName" desc="" />
|
<Param type="const char *" name="fileName" desc="" />
|
||||||
<Param type="const char *" name="ext" desc="" />
|
<Param type="const char *" name="ext" desc="" />
|
||||||
</Function>
|
</Function>
|
||||||
|
<Function name="IsFileHidden" retType="bool" paramCount="1" desc="Check if file path (file or directory) is hidden by OS">
|
||||||
|
<Param type="const char *" name="filePath" desc="" />
|
||||||
|
</Function>
|
||||||
<Function name="GetFileLength" retType="int" paramCount="1" desc="Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h)">
|
<Function name="GetFileLength" retType="int" paramCount="1" desc="Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h)">
|
||||||
<Param type="const char *" name="fileName" desc="" />
|
<Param type="const char *" name="fileName" desc="" />
|
||||||
</Function>
|
</Function>
|
||||||
|
|||||||
@ -774,14 +774,21 @@ int main(int argc, char *argv[])
|
|||||||
// Skip "typedef "
|
// Skip "typedef "
|
||||||
int c = 8;
|
int c = 8;
|
||||||
|
|
||||||
// Type
|
// Type word part
|
||||||
int typeStart = c;
|
int typeStart = c;
|
||||||
while(linePtr[c] != ' ') c++;
|
while(linePtr[c] != ' ') c++;
|
||||||
int typeLen = c - typeStart;
|
int typeLen = c - typeStart;
|
||||||
MemoryCopy(aliases[i].type, &linePtr[typeStart], typeLen);
|
|
||||||
|
|
||||||
// Skip space
|
// Skip space
|
||||||
c++;
|
c++;
|
||||||
|
|
||||||
|
// Maybe type pointer part
|
||||||
|
if (linePtr[c] == '*') {
|
||||||
|
while(linePtr[c] == '*') c++;
|
||||||
|
typeLen = c - typeStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
MemoryCopy(aliases[i].type, &linePtr[typeStart], typeLen);
|
||||||
|
|
||||||
// Name
|
// Name
|
||||||
int nameStart = c;
|
int nameStart = c;
|
||||||
|
|||||||
Reference in New Issue
Block a user