Giter VIP home page Giter VIP logo

switch_between-gitee_and_github_uploads's Introduction

Switch_between-Gitee_and_GitHub_uploads

原理如同两杯水的交换,需要通过第三者实现

img

放在如下目录即可,每次需要用时即可切换 Github服务器在美国,国内访问可能会出现问题,Gitee则为国内网站,访问速度快,但每次修改需要重新部署

#include <iostream>
#include <string>
#include <cstdlib>
 
int main(int argc, char *argv[])
{
	std::string oldName, hName,eName,tName;
#ifdef _WIN32
	oldName = "C:\\Temp\\blog\\_config.yml";
	eName = "C:\\Temp\\blog\\_confige.yml";
	hName = "C:\\Temp\\blog\\_configh.yml";
	tName= "C:\\Temp\\blog\\_configt.yml";
#endif
 
	if (!rename(eName.c_str(), tName.c_str()))
	{
		std::cout << "    准备更改为Gitee模式"<< std::endl;
		if (!rename(oldName.c_str(), hName.c_str()))
			std::cout << "    副本更改为Github模式"<< std::endl;
		else std::cout << "    副本更改为Github模式失败!"<< std::endl;
		
		if (!rename(tName.c_str(), oldName.c_str()))
		std::cout << "    更改为Gitee模式成功!"<< std::endl;
		else std::cout << "    rename error "<< std::endl;
	}
	else
	{
		std::cout << "    rename error或更改为Github模式 "<< std::endl;
		if (!rename(hName.c_str(), tName.c_str()))
		std::cout << "    准备更改为Github模式"<< std::endl;
		else std::cout << "rename error "<< std::endl;
		if (!rename(oldName.c_str(), eName.c_str()))
			std::cout << "    副本更改为Gitee模式"<< std::endl;
		else std::cout << "    副本更改为Gitee模式失败!"<< std::endl;
		
		if (!rename(tName.c_str(), oldName.c_str()))
		std::cout << "    更改为Github模式成功!"<< std::endl;
		else std::cout << "rename error "<< std::endl;
	}
 	system("pause");
	return 0;
}

img

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.