Why is my file path invalid?

Ok, so I had a Unity project on my mac computer and tried transferring into a windows. I’ve tried just using the same file and then also transferring just the assets into a new project. Neither are working and both give me this error saying my directory is no good: “IOException: The directory name is invalid
System.IO.Directory.CreateDirectoriesInternal (System.String path) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.IO.Directory.CreateDirectory (System.String path) (at <437ba245d8404784b9fbab9b439ac908>:0)
SaveLoad.save[T] (T pyramid, System.String key, System.String fileName) (at Assets/Scripts/SaveLoad.cs:18)…”

This program works on my mac and thought my code was universal:

public static class SaveLoad
{
public static string fileType = “.jesus”;

public static void save<T>(T pyramid, string key, string fileName)
{
    BinaryFormatter formatter = new BinaryFormatter();

    string path = Application.persistentDataPath + "/" + fileName + "/";
    Directory.CreateDirectory(path);
    FileStream stream = new FileStream(path + key + fileType, FileMode.Create);

    formatter.Serialize(stream, pyramid);
    stream.Close();
}

public static T load<T>(string key, string fileName)
{
    string path = Application.persistentDataPath + "/" + fileName + "/";

    BinaryFormatter formatter = new BinaryFormatter();
    FileStream stream = new FileStream(path + key + fileType, FileMode.Open);

    T data = (T)formatter.Deserialize(stream);
    stream.Close();

    return data;
}

public static bool checkFile(string key, string fileName)
{
    return File.Exists(Application.persistentDataPath + "/" + fileName + "/" + key + ".jesus");
}

public static bool checkDirectory(string fileName)
{
    return Directory.Exists(Application.persistentDataPath + "/" + fileName + "/");
}

public static void deleteAll(string fileName)
{
    string path = Application.persistentDataPath + "/" + fileName + "/";
    DirectoryInfo directory = new DirectoryInfo(path);
    directory.Delete(true);
    Directory.CreateDirectory(path);
}

}

Windows is using backslashes \ while unix / mac / linux uses forward slashes /. It’ generally recommended to not use slashes at all but to use System.IO.Path.Combine instead.

string path = System.IO.Path.Combine(Application.persistentDataPath, fileName);
string file = System.IO.Path.Combine(path, key + fileType);

@Bunny83
Thank you, that makes a lot of sense.
When trying to create something to fix this:
public static string convertPath(string fileName)
{
string path = Application.persistentDataPath;
path = System.IO.Path.Combine(path, fileName);
UnityEngine.Debug.Log(path);
return path;
}

public static string convertPath(string[] fileNames)
{
    string path = Application.persistentDataPath;// + "/" + fileName;// + "/";
    for (int i = 0; i < fileNames.Length; i++)
    {
        path = System.IO.Path.Combine(path, fileNames*);*

}
UnityEngine.Debug.Log(path);
return path;
}
I added debugs to get e result and got this:
“C:/Users/nopassword/AppData/LocalLow/DefaultCompany/Tiddle\Saves\Main/0:0”
and
“C:/Users/nopassword/AppData/LocalLow/DefaultCompany/Tiddle\Saves”
along with the same error. I tried just correcting the problem by just adding my own slashes and had no suches.
Edit:I forgot to mention. This function is to get the file directory. I realize the names are confusing, I was just trying to make something that worked