Search Unity

Question Convert System.IO to UnityEngine.Windows

Discussion in 'Editor & General Support' started by Razputin, May 13, 2020.

  1. Razputin

    Razputin

    Joined:
    Mar 31, 2013
    Posts:
    356
    I have never used UnityEngine.Windows and it seems it lacks a lot of functionality of System.IO. Can Anyone anyone explain how to convert from System.IO to UnityEngine.Windows? I've read a lot of threads on it but I think the way my save system is set up is making it difficult for me.

    Code (CSharp):
    1.          string subDir = Path.Combine(Application.persistentDataPath, "Saves");
    2.          string path = Path.Combine(subDir, curSaveSelected);
    3.          if (!Directory.Exists(subDir))
    4.          {
    5.              Directory.CreateDirectory(Application.persistentDataPath + "/Saves");
    6.          }
    7.          foreach (string file in Directory.GetFiles(subDir))
    8.          {
    9.              if (Path.GetFileNameWithoutExtension(file) != "Temp")
    10.              {
    11.             //Bunch of stuff not related
    Like what is the equivalent of Path.Combine, or Directory.GetDirectories, as these are not present in UnityEngine.Windows.

    I really appreciate any help, Thanks.
     
    Last edited: May 13, 2020
  2. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
    Why not keep it at System.IO?
    Does it not work?
    UnityEngine.Windows is only a very partial alternative desigend for the UWP platform.
     
    Last edited: May 13, 2020
  3. Razputin

    Razputin

    Joined:
    Mar 31, 2013
    Posts:
    356
    I think UnityEngine.Windows is the wrong library, but I was lead to believe System.IO didn't work on WUP in terms of file creation since WUP prevents access to directories/files outside of the space created by the application. I'm not sure now though...