瀏覽代碼

REDESIGNED: ChangeDirectory()

Not returning error code (or success), just log if it fails
pull/1428/head
Ray 4 年之前
父節點
當前提交
01d9af12f7
共有 2 個文件被更改,包括 7 次插入5 次删除
  1. +5
    -3
      src/core.c
  2. +2
    -2
      src/raylib.h

+ 5
- 3
src/core.c 查看文件

@ -2217,10 +2217,12 @@ void ClearDirectoryFiles(void)
dirFilesCount = 0;
}
// Change working directory, returns true if success
bool ChangeDirectory(const char *dir)
// Change working directory
void ChangeDirectory(const char *dir)
{
return (CHDIR(dir) == 0);
bool result = CHDIR(dir);
if (result != 0) TRACELOG(LOG_WARNING, "SYSTEM: Failed to change to directory: %s", dir);
}
// Check if a file has been dropped into window

+ 2
- 2
src/raylib.h 查看文件

@ -974,8 +974,8 @@ RLAPI void SaveFileData(const char *fileName, void *data, unsigned int bytesToWr
RLAPI char *LoadFileText(const char *fileName); // Load text data from file (read), returns a '\0' terminated string
RLAPI void SaveFileText(const char *fileName, char *text); // Save text data to file (write), string must be '\0' terminated
RLAPI bool FileExists(const char *fileName); // Check if file exists
RLAPI bool IsFileExtension(const char *fileName, const char *ext);// Check file extension (including point: .png, .wav)
RLAPI bool DirectoryExists(const char *dirPath); // Check if a directory path exists
RLAPI bool IsFileExtension(const char *fileName, const char *ext);// Check file extension (including point: .png, .wav)
RLAPI const char *GetFileExtension(const char *fileName); // Get pointer to extension for a filename string (including point: ".png")
RLAPI const char *GetFileName(const char *filePath); // Get pointer to filename for a path string
RLAPI const char *GetFileNameWithoutExt(const char *filePath); // Get filename string without extension (uses static string)
@ -984,7 +984,7 @@ RLAPI const char *GetPrevDirectoryPath(const char *dirPath); // Get previou
RLAPI const char *GetWorkingDirectory(void); // Get current working directory (uses static string)
RLAPI char **GetDirectoryFiles(const char *dirPath, int *count); // Get filenames in a directory path (memory should be freed)
RLAPI void ClearDirectoryFiles(void); // Clear directory files paths buffers (free memory)
RLAPI bool ChangeDirectory(const char *dir); // Change working directory, returns true if success
RLAPI void ChangeDirectory(const char *dir); // Change working directory
RLAPI bool IsFileDropped(void); // Check if a file has been dropped into window
RLAPI char **GetDroppedFiles(int *count); // Get dropped files names (memory should be freed)
RLAPI void ClearDroppedFiles(void); // Clear dropped files paths buffer (free memory)

Loading…
取消
儲存