mirror of
https://github.com/raysan5/raylib.git
synced 2026-07-10 15:51:56 -04:00
Compare commits
3 Commits
a7ac5c2823
...
9f60957b84
| Author | SHA1 | Date | |
|---|---|---|---|
| 9f60957b84 | |||
| 0c0375f8ae | |||
| 77ecd5befc |
@ -1160,7 +1160,8 @@ RLAPI const char *GetWorkingDirectory(void); // Get curre
|
|||||||
RLAPI const char *GetApplicationDirectory(void); // Get the directory of the running application (uses static string)
|
RLAPI const char *GetApplicationDirectory(void); // Get the directory of the running application (uses static string)
|
||||||
RLAPI int MakeDirectory(const char *dirPath); // Create directories (including full path requested), returns 0 on success
|
RLAPI int MakeDirectory(const char *dirPath); // Create directories (including full path requested), returns 0 on success
|
||||||
RLAPI int ChangeDirectory(const char *dirPath); // Change working directory, returns 0 on success
|
RLAPI int ChangeDirectory(const char *dirPath); // Change working directory, returns 0 on success
|
||||||
RLAPI bool IsPathFile(const char *path); // Check if given path is a file or a directory
|
RLAPI bool IsPathFile(const char *path); // Check if given path points to a file
|
||||||
|
RLAPI bool IsPathDirectory(const char *path); // Check if given path points to a directory
|
||||||
RLAPI bool IsFileNameValid(const char *fileName); // Check if fileName is valid for the platform/OS
|
RLAPI bool IsFileNameValid(const char *fileName); // Check if fileName is valid for the platform/OS
|
||||||
RLAPI FilePathList LoadDirectoryFiles(const char *dirPath); // Load directory filepaths, files and directories, no subdirs scan
|
RLAPI FilePathList LoadDirectoryFiles(const char *dirPath); // Load directory filepaths, files and directories, no subdirs scan
|
||||||
RLAPI FilePathList LoadDirectoryFilesEx(const char *basePath, const char *filter, bool scanSubdirs); // Load directory filepaths with extension filtering and subdir scan; some filters available: '*.*','FILES*','DIRS*'
|
RLAPI FilePathList LoadDirectoryFilesEx(const char *basePath, const char *filter, bool scanSubdirs); // Load directory filepaths with extension filtering and subdir scan; some filters available: '*.*','FILES*','DIRS*'
|
||||||
|
|||||||
20
src/rcore.c
20
src/rcore.c
@ -2825,10 +2825,24 @@ int ChangeDirectory(const char *dirPath)
|
|||||||
// Check if given path point to a file
|
// Check if given path point to a file
|
||||||
bool IsPathFile(const char *path)
|
bool IsPathFile(const char *path)
|
||||||
{
|
{
|
||||||
struct stat result = { 0 };
|
bool result = false;
|
||||||
stat(path, &result);
|
|
||||||
|
|
||||||
return S_ISREG(result.st_mode);
|
struct stat info = { 0 };
|
||||||
|
stat(path, &info);
|
||||||
|
|
||||||
|
if (S_ISREG(info.st_mode)) result = true;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if given path point to a directory
|
||||||
|
bool IsPathDirectory(const char *path)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
if (!IsPathFile(path)) result = true;
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if fileName is valid for the platform/OS
|
// Check if fileName is valid for the platform/OS
|
||||||
|
|||||||
35
src/rtext.c
35
src/rtext.c
@ -2200,18 +2200,43 @@ char *TextToSnake(const char *text)
|
|||||||
if (text != NULL)
|
if (text != NULL)
|
||||||
{
|
{
|
||||||
// Check for next separator to upper case another character
|
// Check for next separator to upper case another character
|
||||||
for (int i = 0, j = 0; (i < MAX_TEXT_BUFFER_LENGTH - 1) && (text[j] != '\0'); i++, j++)
|
for (int i = 0, j = 0; (i < MAX_TEXT_BUFFER_LENGTH - 1) && (text[j] != '\0'); j++)
|
||||||
{
|
{
|
||||||
if ((text[j] >= 'A') && (text[j] <= 'Z'))
|
if (text[j] == ' ')
|
||||||
{
|
{
|
||||||
if (i >= 1)
|
if ((i > 0) && (buffer[i - 1] != '_'))
|
||||||
{
|
{
|
||||||
buffer[i] = '_';
|
buffer[i] = '_';
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
buffer[i] = text[j] + 32;
|
|
||||||
}
|
}
|
||||||
else buffer[i] = text[j];
|
else if ((text[j] >= 'A') && (text[j] <= 'Z'))
|
||||||
|
{
|
||||||
|
if ((i > 0) && (buffer[i - 1] != '_'))
|
||||||
|
{
|
||||||
|
char prev = text[j - 1];
|
||||||
|
char next = text[j + 1];
|
||||||
|
|
||||||
|
// Considering multiple cap leters to be on single word (HTTPRequest --> http_request)
|
||||||
|
if (((prev >= 'a') && (prev <= 'z')) ||
|
||||||
|
(((prev >= 'A') && (prev <= 'Z')) && ((next >= 'a') && (next <= 'z'))))
|
||||||
|
{
|
||||||
|
if (i < MAX_TEXT_BUFFER_LENGTH - 2)
|
||||||
|
{
|
||||||
|
buffer[i] = '_';
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer[i] = text[j] + 32;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buffer[i] = text[j];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4657,7 +4657,18 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "IsPathFile",
|
"name": "IsPathFile",
|
||||||
"description": "Check if given path is a file or a directory",
|
"description": "Check if given path points to a file",
|
||||||
|
"returnType": "bool",
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "const char *",
|
||||||
|
"name": "path"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "IsPathDirectory",
|
||||||
|
"description": "Check if given path points to a directory",
|
||||||
"returnType": "bool",
|
"returnType": "bool",
|
||||||
"params": [
|
"params": [
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4177,7 +4177,15 @@ return {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "IsPathFile",
|
name = "IsPathFile",
|
||||||
description = "Check if given path is a file or a directory",
|
description = "Check if given path points to a file",
|
||||||
|
returnType = "bool",
|
||||||
|
params = {
|
||||||
|
{type = "const char *", name = "path"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "IsPathDirectory",
|
||||||
|
description = "Check if given path points to a directory",
|
||||||
returnType = "bool",
|
returnType = "bool",
|
||||||
params = {
|
params = {
|
||||||
{type = "const char *", name = "path"}
|
{type = "const char *", name = "path"}
|
||||||
|
|||||||
@ -3033,7 +3033,13 @@
|
|||||||
((type "const char *") (name "dirPath"))))
|
((type "const char *") (name "dirPath"))))
|
||||||
|
|
||||||
((name "IsPathFile")
|
((name "IsPathFile")
|
||||||
(description "Check if given path is a file or a directory")
|
(description "Check if given path points to a file")
|
||||||
|
(return-type "bool")
|
||||||
|
(params
|
||||||
|
((type "const char *") (name "path"))))
|
||||||
|
|
||||||
|
((name "IsPathDirectory")
|
||||||
|
(description "Check if given path points to a directory")
|
||||||
(return-type "bool")
|
(return-type "bool")
|
||||||
(params
|
(params
|
||||||
((type "const char *") (name "path"))))
|
((type "const char *") (name "path"))))
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -681,7 +681,7 @@
|
|||||||
<Param type="unsigned int" name="frames" desc="" />
|
<Param type="unsigned int" name="frames" desc="" />
|
||||||
</Callback>
|
</Callback>
|
||||||
</Callbacks>
|
</Callbacks>
|
||||||
<Functions count="611">
|
<Functions count="612">
|
||||||
<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="" />
|
||||||
@ -1115,7 +1115,10 @@
|
|||||||
<Function name="ChangeDirectory" retType="int" paramCount="1" desc="Change working directory, returns 0 on success">
|
<Function name="ChangeDirectory" retType="int" paramCount="1" desc="Change working directory, returns 0 on success">
|
||||||
<Param type="const char *" name="dirPath" desc="" />
|
<Param type="const char *" name="dirPath" desc="" />
|
||||||
</Function>
|
</Function>
|
||||||
<Function name="IsPathFile" retType="bool" paramCount="1" desc="Check if given path is a file or a directory">
|
<Function name="IsPathFile" retType="bool" paramCount="1" desc="Check if given path points to a file">
|
||||||
|
<Param type="const char *" name="path" desc="" />
|
||||||
|
</Function>
|
||||||
|
<Function name="IsPathDirectory" retType="bool" paramCount="1" desc="Check if given path points to a directory">
|
||||||
<Param type="const char *" name="path" desc="" />
|
<Param type="const char *" name="path" desc="" />
|
||||||
</Function>
|
</Function>
|
||||||
<Function name="IsFileNameValid" retType="bool" paramCount="1" desc="Check if fileName is valid for the platform/OS">
|
<Function name="IsFileNameValid" retType="bool" paramCount="1" desc="Check if fileName is valid for the platform/OS">
|
||||||
|
|||||||
Reference in New Issue
Block a user