Repository: godotengine/godot
File: editor/filesystem_dock.cpp (C++)

Code before:
	print_verbose("FileSystem: saving moved scenes.");
	_save_scenes_after_move(file_renames);

	path = new_path;
	current_path->set_text(path);
}

void FileSystemDock::_duplicate_operation_confirm() {
	String new_name = duplicate_dialog_text->get_text().strip_edges();
	if (new_name.length() == 0) {
		EditorNode::get_singleton()->show_warning(TTR("No name provided."));
		return;
	} else if (new_name.find("/") != -1 || new_name.find("\\") != -1 || new_name.find(":") != -1) {
		EditorNode::get_singleton()->show_warning(TTR("Name contains invalid characters."));
		return;
	}

	String base_dir = to_duplicate.path.get_base_dir();
	// get_base_dir() returns "some/path" if the original path was "some/path/", so work it around.
	if (to_duplicate.path.ends_with("/")) {
		base_dir = base_dir.get_base_dir();
	}

	String new_path = base_dir.plus_file(new_name);

	// Present a more user friendly warning for name conflict
	DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
	if (da->file_exists(new_path) || da->dir_exists(new_path)) {
		EditorNode::get_singleton()->show_warning(TTR("A file or folder with this name already exists."));
		memdelete(da);
		return;
	}
	memdelete(da);

	_try_duplicate_item(to_duplicate, new_path);

	// Rescan everything.
	print_verbose("FileSystem: calling rescan.");
	_rescan();
}

void FileSystemDock::_move_with_overwrite() {
	_move_operation_confirm(to_move_path, true);
}

Vector<String> FileSystemDock::_check_existing() {
	Vector<String> conflicting_items;
	String &p_to_path = to_move_path;
	for (int i = 0; i < to_move.size(); i++) {
		String ol_pth = to_move[i].path.ends_with("/") ? to_move[i].path.substr(0, to_move[i].path.length() - 1) : to_move[i].path;
		String p_new_path = p_to_path.plus_file(ol_pth.get_file());

Review comment (suggestion):
```suggestion
	} else if (new_name[0] == '.') {
```

Code after:
	print_verbose("FileSystem: calling rescan.");
	_rescan();

	print_verbose("FileSystem: saving moved scenes.");
	_save_scenes_after_move(file_renames);

	path = new_path;
	current_path->set_text(path);
}

void FileSystemDock::_duplicate_operation_confirm() {
	String new_name = duplicate_dialog_text->get_text().strip_edges();
	if (new_name.length() == 0) {
		EditorNode::get_singleton()->show_warning(TTR("No name provided."));
		return;
	} else if (new_name.find("/") != -1 || new_name.find("\\") != -1 || new_name.find(":") != -1) {
		EditorNode::get_singleton()->show_warning(TTR("Name contains invalid characters."));
		return;
	} else if (new_name[0] == '.') {
		EditorNode::get_singleton()->show_warning(TTR("Name begins with a dot."));
		return;
	}

	String base_dir = to_duplicate.path.get_base_dir();
	// get_base_dir() returns "some/path" if the original path was "some/path/", so work it around.
	if (to_duplicate.path.ends_with("/")) {
		base_dir = base_dir.get_base_dir();
	}

	String new_path = base_dir.plus_file(new_name);

	// Present a more user friendly warning for name conflict
	DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
	if (da->file_exists(new_path) || da->dir_exists(new_path)) {
		EditorNode::get_singleton()->show_warning(TTR("A file or folder with this name already exists."));
		memdelete(da);
		return;
	}
	memdelete(da);

	_try_duplicate_item(to_duplicate, new_path);

	// Rescan everything.
	print_verbose("FileSystem: calling rescan.");
	_rescan();
}

void FileSystemDock::_move_with_overwrite() {
	_move_operation_confirm(to_move_path, true);
}