Example #1
0
        private async ValueTask <string> InitializeHistoryDirectoryAsync(string filename)
        {
            var saveName = Path.GetFileNameWithoutExtension(filename);
            var path     = Path.Join(BaseDirectory, Prefix + saveName);

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);

                var corgit = new Corgit(GitPath, path);
                await corgit.InitAsync();

                await corgit.ConfigAsync("user.name", value : "ironmunge");

                await corgit.ConfigAsync("user.email", value : "@v0.1.0");

                await corgit.ConfigAsync("push.default", value : "current");

                //unset text to disable eol conversions
                var gitattributesPath = Path.Join(path, ".gitattributes");
                await File.WriteAllLinesAsync(gitattributesPath, DefaultGitAttributes);

                await corgit.AddAsync();

                await corgit.CommitAsync("Initialize save history");
            }

            return(path);
        }
        private async Task InitializeHistoryDirectoryAsync(string path)
        {
            Directory.CreateDirectory(path);

            var corgit = new Corgit(GitPath, path);
            await corgit.InitAsync();

            await corgit.ConfigAsync("user.name", value : "ironmunge");

            await corgit.ConfigAsync("user.email", value : "@v0.1");
        }