Ejemplo n.º 1
0
        public Task Clean()
        {
            FSBuilder builder = new FSBuilder(Environment.CurrentDirectory);

            builder.EnsureDirectoryExists("temp", false);
            return(Task.CompletedTask);
        }
Ejemplo n.º 2
0
        // TODO: fix rewrite behavior
        public async Task Initialize()
        {
            Option = new WorkspaceOption();
            DB     = new DB();
            await Save();

            FSBuilder builder = new FSBuilder(Environment.CurrentDirectory);

            builder.EnsureDirectoryExists("posts");
            builder.EnsureDirectoryExists("pages");
            builder.EnsureDirectoryExists("layouts");
            builder.EnsureDirectoryExists(AssetsPath);

            {
                await using var st = builder.GetFileRewriteStream(BlogOptionPath);
                await JsonSerializer.SerializeAsync(st, new BlogOptions(), options : new JsonSerializerOptions
                {
                    WriteIndented = true
                });
            }

            await Clean();
        }