Adding nix shell and reworking some parser/local file manager stuff

This commit is contained in:
2026-01-23 23:09:56 -06:00
parent ad2e074991
commit 45cd325818
6 changed files with 48 additions and 16 deletions

View File

@@ -1,4 +1,6 @@
using System.Reflection.Metadata;
using SzLib;
using SzLib.DataObjects;
namespace SzCli;
@@ -18,10 +20,16 @@ public class LocalFileManager : ISzFileManager
}
}
public string DatasetsPath => Path.Combine(DataPath, "datasets");
public bool SaveFile(string path, string fileContent)
{
try
{
var dir = Path.GetDirectoryName(path);
if (dir is null) return false;
Directory.CreateDirectory(dir);
File.WriteAllText(path, fileContent);
return true;
}
@@ -31,4 +39,17 @@ public class LocalFileManager : ISzFileManager
return false;
}
}
}
public string? LoadFile(string path)
{
try
{
return File.ReadAllText(path);
}
catch (Exception e)
{
Console.WriteLine($"Error saving file: {e.Message}");
return null;
}
}
}