diff options
Diffstat (limited to 'editor/editor_vcs_interface.cpp')
-rw-r--r-- | editor/editor_vcs_interface.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/editor/editor_vcs_interface.cpp b/editor/editor_vcs_interface.cpp index eaa8f891ec..97611d9786 100644 --- a/editor/editor_vcs_interface.cpp +++ b/editor/editor_vcs_interface.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -166,3 +166,24 @@ EditorVCSInterface *EditorVCSInterface::get_singleton() { void EditorVCSInterface::set_singleton(EditorVCSInterface *p_singleton) { singleton = p_singleton; } + +void EditorVCSInterface::create_vcs_metadata_files(VCSMetadata p_vcs_metadata_type, String &p_dir) { + if (p_vcs_metadata_type == VCSMetadata::GIT) { + FileAccess *f = FileAccess::open(p_dir.plus_file(".gitignore"), FileAccess::WRITE); + if (!f) { + ERR_FAIL_MSG(TTR("Couldn't create .gitignore in project path.")); + } else { + f->store_line("# Godot 4+ specific ignores"); + f->store_line(".godot/"); + memdelete(f); + } + f = FileAccess::open(p_dir.plus_file(".gitattributes"), FileAccess::WRITE); + if (!f) { + ERR_FAIL_MSG(TTR("Couldn't create .gitattributes in project path.")); + } else { + f->store_line("# Normalize EOL for all files that Git considers text files."); + f->store_line("* text=auto eol=lf"); + memdelete(f); + } + } +} |