Files
minecraft-bedrock-json-schemas/test/src/Utillity.ts

33 lines
842 B
TypeScript
Raw Normal View History

2021-08-18 20:15:02 +02:00
import FastGlob = require("fast-glob");
import path = require("path");
2021-08-18 17:15:20 +02:00
export namespace Files {
2021-08-18 20:15:02 +02:00
export function TestFolder(): string {
2021-08-18 20:48:09 +02:00
return path.join(__dirname, "..", "..", "..", "test");
2021-08-18 20:15:02 +02:00
}
2021-08-18 17:15:20 +02:00
2021-08-18 20:15:02 +02:00
export function RootFolder(): string {
return path.join(TestFolder(), "..");
}
export function FilesFolder(): string {
return path.join(TestFolder(), "files");
}
export function CorrectFilesFolder(): string {
return path.join(FilesFolder(), "correct");
}
export function InCorrectFilesFolder(): string {
return path.join(FilesFolder(), "incorrect");
}
export function GetFiles(folder: string): string[] {
2021-08-18 20:48:09 +02:00
if (!folder.endsWith("\\")) folder += "\\";
folder = folder.replace("\\", "/");
return FastGlob.sync(["*.json", "**/*.json"], { absolute: true, onlyFiles: true, cwd: folder });
2021-08-18 20:15:02 +02:00
}
2021-08-18 17:15:20 +02:00
}