mirror of
https://github.com/aria2/aria2.git
synced 2025-04-07 06:27:37 +03:00
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:
parent
e26bbbb9ee
commit
048a2cf597
252 changed files with 8646 additions and 5343 deletions
23
src/File.cc
23
src/File.cc
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue