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:
    1. Directory Integrity: Automatically extracts the directory from the path and creates it if it doesn’t exist (e.g., creating a “Saves” folder).
    2. Pathing: Defaults to Application.persistentDataPath if a relative filename is provided.
    3. Writing: Uses CanleyCSVWriter to commit the RFC 4180 compliant string to disk.
  • Parameters:
    • path: The target destination path or filename.
    • content: The string content to be saved.
  • Returns: booltrue if the save operation was successful.
  • Example:
string myData = "Score,Date\n100,2026-04-02";
csvManager.SaveToFile("Highscores.csv", myData);

WARNING

Ensure the content string has been properly escaped using CanleyCSVWriter utilities before saving to maintain CSV standards.