@specs-feup/lara
Version:
A js port of the popular framework for building source-to-source compilers
16 lines (12 loc) • 443 B
text/typescript
import { JavaClasses } from "../util/JavaTypes.js";
import Strings from "../Strings.js";
export default class ToolUtils {
static parsePath(path: string | JavaClasses.File): string {
// Ensure paths use / instead of \
// Using regular expression in order to replace all
let parsedPath = path.toString().replace(/\\/g, "/");
// Escape characters
parsedPath = Strings.escapeJson(parsedPath);
return parsedPath;
}
}