2007-10-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Implemented BitTorrent/http/ftp integrated download.
	I've rewritten lots of files and now some headers have forward
	class declarations to reduce compile time.
	The implementation is extremely alpha stage, I recommend to use this
	for testing purpose only.
This commit is contained in:
Tatsuhiro Tsujikawa 2007-10-11 16:58:24 +00:00
parent e26bbbb9ee
commit 048a2cf597
252 changed files with 8646 additions and 5343 deletions

View file

@ -37,6 +37,11 @@
#include "a2io.h"
#include <libgen.h>
#ifdef __MINGW32__
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
#endif // __MINGW32__
File::File(const string& name):name(name) {}
File::~File() {}
@ -140,3 +145,21 @@ bool File::isDir(const string& filename)
{
return File(filename).isDir();
}
bool File::renameTo(const string& dest)
{
#ifdef __MINGW32__
/* MinGW's rename() doesn't delete an existing destination */
if (_access(dest.c_str(), 0) == 0) {
if (_unlink(dest.c_str()) != 0) {
return false;
}
}
#endif // __MINGW32__
if(rename(name.c_str(), dest.c_str()) == 0) {
name = dest;
return true;
} else {
return false;
}
}