Detailed Method Reference
Namespace: Canley.Utility.CSV
Class: CanleyCSVManager
SaveToFile
public bool SaveToFile(string path, string content)- Description: Exports a CSV string to the local disk, handling folder creation and platform-specific pathing automatically.
- Workflow:
- Directory Integrity: Automatically extracts the directory from the path and creates it if it doesn’t exist (e.g., creating a “Saves” folder).
- Pathing: Defaults to
Application.persistentDataPathif a relative filename is provided. - Writing: Uses
CanleyCSVWriterto commit the RFC 4180 compliant string to disk.
- Parameters:
path: The target destination path or filename.content: The string content to be saved.
- Returns:
bool—trueif the save operation was successful. - Example:
string myData = "Score,Date\n100,2026-04-02";
csvManager.SaveToFile("Highscores.csv", myData);WARNING
Ensure the
contentstring has been properly escaped usingCanleyCSVWriterutilities before saving to maintain CSV standards.