diff --git a/Capy64/Runtime/Libraries/FileSystemLib.cs b/Capy64/Runtime/Libraries/FileSystemLib.cs index 398248c..2a98aad 100644 --- a/Capy64/Runtime/Libraries/FileSystemLib.cs +++ b/Capy64/Runtime/Libraries/FileSystemLib.cs @@ -134,6 +134,9 @@ public class FileSystemLib : IComponent // Get drive root (C:\ for Windows, / for *nix) var rootPath = Path.GetFullPath(Path.GetPathRoot("/") ?? "/"); + var invalidPathChars = Path.GetInvalidPathChars(); + path = invalidPathChars.Aggregate(path, (current, invalidChar) => current.Replace(invalidChar, ' ')); + // Join path to rootPath and resolves to absolute path // Relative paths are resolved here (es. ../ and ./) var absolutePath = Path.GetFullPath(path, rootPath);