Exemple #1
0
    public Option <FilePath> ExportSpec(ICommandSpec spec, FolderPath root, FileExtension Extension, bool FlattenHierarchy)
    {
        var ext       = Extension ?? ".spec";
        var dstFolder = FlattenHierarchy ? root : root.GetCombinedFolderPath(spec.CommandName.Identifier.Split('/').Last());

        dstFolder.CreateIfMissing().Require();
        var path = dstFolder + (new FileName(spec.SpecName) + ext);
        var json = serializer.Encode(spec);

        File.WriteAllText(path, json);
        return(path);
    }