From 701434ef99bbd94e5f4524b2096ea528d97dc7b3 Mon Sep 17 00:00:00 2001 From: ChrisDill Date: Tue, 29 Dec 2020 16:19:08 +0000 Subject: [PATCH] Remove file management functions in favour of `System.IO` alternatives - These functions have a similar api to System.IO functions in C#. For example 'DirectoryExists' can be replaced with 'Directory.Exists'. - I considered wrapping them to use `System.IO` internally however that is less flexible than using it directly. --- Raylib-cs/Raylib.cs | 48 --------------------------------------------- 1 file changed, 48 deletions(-) diff --git a/Raylib-cs/Raylib.cs b/Raylib-cs/Raylib.cs index 545f368..d4e3300 100644 --- a/Raylib-cs/Raylib.cs +++ b/Raylib-cs/Raylib.cs @@ -1177,65 +1177,17 @@ namespace Raylib_cs // Load file data as byte array (read) [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - [return: MarshalAs(UnmanagedType.I1)] public static extern byte[] LoadFileData(string fileName, ref int bytesRead); // Save data to file from byte array (write) [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] public static extern void SaveFileData(string fileName, IntPtr data, int bytesToWrite); - // Check if file exists - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - [return: MarshalAs(UnmanagedType.I1)] - public static extern bool FileExists(string fileName); - // Check file extension [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.I1)] public static extern bool IsFileExtension(string fileName, string ext); - // Check if a directory path exists - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - [return: MarshalAs(UnmanagedType.I1)] - public static extern bool DirectoryExists(string dirPath); - - // Get pointer to extension for a filename string - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern string GetFileExtension(string fileName); - - // Get pointer to filename for a path string - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern string GetFileName(string filePath); - - // Get filename string without extension (uses static string) - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern string GetFileNameWithoutExt(ref string filePath); - - // Get full path for a given fileName (uses static string) - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern string GetDirectoryPath(string fileName); - - // Get previous directory path for a given path (uses static string) - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern string GetPrevDirectoryPath(string dirPath); - - // Get current working directory (uses static string) - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern string GetWorkingDirectory(); - - // Get filenames in a directory path (memory should be freed) - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern string[] GetDirectoryFiles(string dirPath, ref int count); - - // Clear directory files paths buffers (free memory) - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - public static extern void ClearDirectoryFiles(); - - // Change working directory, returns true if success - [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] - [return: MarshalAs(UnmanagedType.I1)] - public static extern bool ChangeDirectory(string dir); - // Check if a file has been dropped into window [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.I1)]